Sprite Candy and Z-Order
Blitz3D Forums/Blitz3D Userlibs/Sprite Candy and Z-Order
| ||
I want to create a Sprite Candy image and place it as a background behind all other 3D objects of my scene I tried the HUD_SetObjectOrder but it seems that affects only the order between Sprite Candy objects Any idea? Thanks |
| ||
Try HUD_SetLayerOrder |
| ||
Not sure this has anything to do with Z orders or layer order. It sounds more like you want to render a 2D image behind 3D. To do this you will need to need to render twice. Render the 2d background layer, then render the 3D layer. You will need to set the cameracls attributes so the 3D render does not wipe out your 2D layer. |
| ||
Boiled Sweets: I tried your tip but it didn't work Uncle: I tested the following code . . . Hud_SetObjectVisibility(myimage, True) CameraClsMode False, True Repeat ; do level stuff update Flip HUD_Update RenderWorld FrameTween Until leveldone . . . but it didn't work also I think Sprite Candy objects are actually 3D objects and it is not necessary to play with the 2D background layer... I am wondering if there is a way to retrieve Blitz3D entity's handle from a Sprite Candy object? |
| ||
Hhmmm strange. I posted the below code about 2 hours ago, but it was deleted. Anyway I will post it again for anyone else who wants a solution to this problem...Graphics3D 800,600,0 Include "sprite candy.bb" camera=CreateCamera() light=CreateLight() LightColor light,50,50,50 cube=CreateCube() PositionEntity cube,0,0,5 Texture% = CreateTexture(256,256,1+256) SetBuffer TextureBuffer(texture) Color 0,0,250 Rect 0,0,256,256,1 Color 0,0,200 Rect 0,0,128,128,1 Rect 128,128,128,128,1 SetBuffer BackBuffer() BackHUD% = HUD_Create (camera) FrontHUD% = HUD_Create (camera) Resource% = HUD_LoadMemoryResource (Texture) BackImageLayer% = HUD_CreateLayer (BackHUD, Resource) FrontImageLayer% = HUD_CreateLayer (FrontHUD%, Resource) Texture = HUD_GetTextureHandle (Resource) ; CREATED AN IMAGE THAT FITS ENTIRE SCREEN (BACK LAYER) Image1% = HUD_CreateImage (BackImageLayer, 0,0, 0,0,800,600, "CENTER","CENTER") HUD_SetObjectScale Image1,2,2 HUD_SetObjectAlpha Image1,.5 ; APPLY SOME EFFECTS HUD_FX_SteadyScale Image1, 2,2,2*1.2,2*1.2,4000 HUD_FX_Ripple Image1, 5,20,15 ; NOW SOME OBJECTS INFRONT (FRONT LAYER) ShapeHandle% = HUD_CreateShape ( FrontImageLayer%, "HOLLOWSTAR" , 6, 60, 400, 300, 400,400 ) ; APPLY SOME EFFECTS EffectHandle% = HUD_FX_Rotate ( ShapeHandle%, 360, True, 7000, 0 ) EffectHandle% = HUD_FX_SteadyScale ( ShapeHandle%, 0.5, 0.5, 1.5, 1.5, 3000,0) HUD_SetObjectColor ( ShapeHandle%, 0, 255, 255) HUD_SetObjectShadow ( ShapeHandle%, True, 10 ) CameraClsMode camera,False,True While Not KeyDown(1) If HUD_CountEffects(ShapeHandle,"ROTATE")=0 Then EffectHandle% = HUD_FX_Rotate ( ShapeHandle%, 360, True, 7000, 0 ) If HUD_CountEffects(ShapeHandle,"COLORFADE")=0 Then EffectHandle% = HUD_FX_ColorFade ( ShapeHandle%, 255,255,0, 3000,0 ) EffectHandle% = HUD_FX_ColorFade ( ShapeHandle%, 0,255,255, 3000,3000 ) EndIf HUD_SetVisibility(BackHud,True) HideEntity cube HUD_Update() RenderWorld() HUD_SetVisibility(BackHud,False) ShowEntity cube TurnEntity cube,0.5,0.5,0.5 RenderWorld 0 Flip Wend Cheers, Unc |
| ||
What can I say... You are great man! (My post deleted too..) |
| ||
You can just set ZOrder for entire HUDs, without rendering to times. For example: Graphics3D 800,600,0 Include "../sprite candy.bb" camera=CreateCamera() light=CreateLight() LightColor light,50,50,50 cube=CreateCube() PositionEntity cube,0,0,5 Texture% = CreateTexture(256,256,1+256) SetBuffer TextureBuffer(texture) Color 0,0,250 Rect 0,0,256,256,1 Color 0,0,200 Rect 0,0,128,128,1 Rect 128,128,128,128,1 SetBuffer BackBuffer() BackHUD% = HUD_Create (camera,800,600,-100) FrontHUD% = HUD_Create (camera,800,600,100) Resource% = HUD_LoadMemoryResource (Texture) BackImageLayer% = HUD_CreateLayer (BackHUD, Resource) FrontImageLayer% = HUD_CreateLayer (FrontHUD%, Resource) Texture = HUD_GetTextureHandle (Resource) ; CREATED AN IMAGE THAT FITS ENTIRE SCREEN (BACK LAYER) Image1% = HUD_CreateImage (BackImageLayer, 0,0, 0,0,800,600, "CENTER","CENTER") HUD_SetObjectScale Image1,2,2 HUD_SetObjectAlpha Image1,.5 ; APPLY SOME EFFECTS HUD_FX_SteadyScale Image1, 2,2,2*1.2,2*1.2,4000 HUD_FX_Ripple Image1, 5,20,15 ; NOW SOME OBJECTS INFRONT (FRONT LAYER) ShapeHandle% = HUD_CreateShape ( FrontImageLayer%, "HOLLOWSTAR" , 6, 60, 400, 300, 400,400 ) ; APPLY SOME EFFECTS EffectHandle% = HUD_FX_Rotate ( ShapeHandle%, 360, True, 7000, 0 ) EffectHandle% = HUD_FX_SteadyScale ( ShapeHandle%, 0.5, 0.5, 1.5, 1.5, 3000,0) HUD_SetObjectColor ( ShapeHandle%, 0, 255, 255) HUD_SetObjectShadow ( ShapeHandle%, True, 10 ) ;CameraClsMode camera,False,True While Not KeyDown(1) If HUD_CountEffects(ShapeHandle,"ROTATE")=0 Then EffectHandle% = HUD_FX_Rotate ( ShapeHandle%, 360, True, 7000, 0 ) If HUD_CountEffects(ShapeHandle,"COLORFADE")=0 Then EffectHandle% = HUD_FX_ColorFade ( ShapeHandle%, 255,255,0, 3000,0 ) EffectHandle% = HUD_FX_ColorFade ( ShapeHandle%, 0,255,255, 3000,3000 ) EndIf ; HUD_SetVisibility(BackHud,True) ; HideEntity cube HUD_Update() ; RenderWorld() ; HUD_SetVisibility(BackHud,False) ; ShowEntity cube TurnEntity cube,0.5,0.5,0.5 RenderWorld Flip Wend |
| ||
rtur: I missed your post. Your solution is better by far because saves rendering time By the way, do you want to give me a taste of your working pipeline on how you made these wonderful terrains on Master On Defense. I want to make some like of them in my Xplorer game Thanks a lot |
| ||
Moraldi We have used B3D Pipeline made by Pudding to create levels in Master of Defense. No extra tools or level editors used. You can set create few meshes in 3D Studio and set individual texture on each. Then use alpha maps, or vertex alpha to make holes in this meshes to create translations from ground to grass, for example. |
| ||
Oh, I see.. I don't own 3D Studio because it is too expensive fro me, but I think I can try your guidelines using Silo and UUnwrap |
| ||
You can download a demos of 3d Studio Max for free, it gives you a month. Download it here: http://nct.digitalriver.com/fulfill/0049.034/download/2005-3204e1e566ba3ed1d3d99cbf7f3fae21-3 |