Hi guys!
In TestTerrainSplatting class, I added Skybox object. And then, skybox object is rendered in front of terrain object.
So, you can't see terrain, just skybox.
How to solve this problem!
You probably need to make the skybox bigger. Make sure that bottom of skybox is below lowest point in terrain. The TestIsland class in the same test package adds a skybox to the splatting, and you can see how it is done there.
did you add this
ZBufferState buf = display.getRenderer().createZBufferState();
buf.setEnabled(true);
buf.setFunction(ZBufferState.CF_LEQUAL);
scene.setRenderState(buf);
if you don't add it it won't display the dephts right
Also, the order in which you add the skybox node and the terrain node to the root node matters.
Yeah, you right!
I forgot the order in which I add the skybox. As a result, I fixed it!
Thanks guys!
can someone explain why the order is important? shouldn't the ZBufferState be enough?
If the skybox is drawn first, and is not writing to the ZBuffer, then the Terrain is drawn… then the Skybox should appear behind the terrain no?
The terrain is drawn first, writing to the ZBuffer. Then the skybox is drawn, which is actually a 1x1x1 box centered on the camera, it checks the depth and finds that the skybox is closer than any terrain, so what you get is skybox all over the screen.
Using a large skybox only limits the view distance and causes overdraw, use a 1x1x1 skybox, drawn first, with Z write disabled, then draw the rest of the stuff.
Using a large skybox only limits the view distance and causes overdraw, use a 1x1x1 skybox, drawn first, with Z write disabled, then draw the rest of the stuff.
Hi Momoko_Fan,
I use BasicGameState, so I had rootNode with ZBuffer is enabled by default.
It's OK when I add a skybox first, but not if the order is changed.
And now, I have 2 questions:
1) It's OK even if I don't do like that "use a 1x1x1 skybox, drawn first, with Z write disabled", could you explain to me?
2) I use a 5x5x5 skybox, Does it affect the purview of scene?
I had rootNode with ZBuffer is enabled by default.
I don't think you understood what I meant. I didn't say that you should disable the ZBuffer state, but only to disable Z writing. you do that with the call setWritable(false) on the ZBuffer state.
I use a 5x5x5 skybox, Does it affect the purview of scene?
In my experience, using a larger skybox causes floating point errors during drawing, which makes odd black pixels near the edges of the skybox. That's why I said that you should use the smallest skybox possible with Z write disabled.
I followed this thread closely.
Changed my skybox to 2x2x2 now even my 3ds Texture shows up after changing orders
BUT
I have a monitor set up which is a textureRenderer with a second cam. This second cam has a position far away from first cam.
So the skybox since it is so small now is shown there as a block.
How could I also show the skybox in the textures Renderer Camera correctly.
My first aproach was a skybox 30x30x30 which worked obviously
and what is the difference of
ZBufferState zState = display.getRenderer().createZBufferState();
this ->>>> zState.setEnabled(false);
and that ->>>> zState.setWritable(false);
skybox.setRenderState(zState);
both work for me with small box
but not with texture renderer cam
I guess I need another skybox for my texturer Renderer but adding 2 skys to different nodes does not work at all.
i had this problem too, i just went with no skybox hehe.
but i guess you need to update the skybox location twice per render cycle.
once for the main renderer and then for the second cam.
Or maybe have two skyboxes and cull one when rendering the other?
Before rendering in the TextureRenderer, center the Skybox on the TextureRenderer's camera.
this ->>>> zState.setEnabled(false);
and that ->>>> zState.setWritable(false);
Actually if I think about this the only difference is if you have something drawn before the skybox, which you shouldn't, so either option works the same.