Sign in to follow this  

Going "Inside" Skybox

This topic is 4861 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey - when I view my skybox, I can see it fine from the outside (textured and everything) but when I try to go inside the skybox (whcih is obviously what I want) it disappears :s! Yes, the skybox is 'deep' :-), so i did'nt "Exit" the skybox right when I entered it. Can anything be done? pent

Share this post


Link to post
Share on other sites
Yes, reverse the normals in your skybox.

Don't want to do that? Well, then just reverse DX's culling order. Example:

g_pd3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW);

Don't forget to set it back (D3DCULL_CCW).

Share this post


Link to post
Share on other sites
Are you loading the sky box from a mesh? If so, what modeling program are you using to create it?

edit: why I want to now is because there are ways to reverse the normals in some modeling programs - could save you some trouble [wink]

Share this post


Link to post
Share on other sites
Reversing the normals won't help since culling is based on the winding order of the vertices. If it's an indexed mesh then you can just iterate through each set of three indices and swap two of them.

Or just change the CULLMODE state as FenrirWolf said.

Share this post


Link to post
Share on other sites
The alley_skybox should be fine, no need to play with the normals. I wonder if it is something else that is going wrong. I have a page on skybox coding here: skybox if you are interested.

Share this post


Link to post
Share on other sites
Quote:
Original post by Donavon Keithley
If it's an indexed mesh then you can just iterate through each set of three indices and swap two of them.


This is probably a much better idea than changing the CULLMODE. Disabling and then reenabling culling will take hundreds of cycles. Not that I'm into micro-optimizing but changing the winding order is just as easy, and then it requires no special handling.

Share this post


Link to post
Share on other sites
Quote:
Original post by __Daedalus__
You have the option to flip normals if you use the Panda Exporter to export your .X files from 3DS Max.
Also (since you are using 3ds Max), you could apply a 'Normal' modifier to the mesh and select 'Flip Normals' on the Parameters rollout. If you go to Customize -> Viewport Configuration -> Rendering Method -> Force 2-Sided, the mesh will render completely (in the viewport), so you won't have non-visible faces from the inverted normals.

Share this post


Link to post
Share on other sites
Quote:
Original post by JohnBolton
Don't change the cull mode. That's a bad idea. The problem is that the vertexes are in the wrong order. Fix the problem.

I agree with this. But if you re-set the cullmode after rendering the SkyBox, I don't think there's a big problem. Just don't leave it always off.

Share this post


Link to post
Share on other sites
Hang on he said he is using alley_skybox, well the normals on that are fine they are pointing in. People seem to be trying to solve a problem that does not exist - I think the problem must be elsewhere in his code. That is unless I have completely failed to follow this discussion :)

Share this post


Link to post
Share on other sites
Quote:
Original post by Donavon Keithley
If it's an indexed mesh then you can just iterate through each set of three indices and swap two of them.


Just to clarify:

Culling modes detect the normal of a polygon by the winding order of the vertices. So if you have your vertices go

Vert1 Vert2 Vert3

In the vertex buffer then reversing that by going

Vert3 Vert2 Vert1

reverses the winding order and thus changes the normal of the polygon. That way you don't have to change the cull_mode state everytime you render your skybox.

~Wave

Share this post


Link to post
Share on other sites
Correct me if I'm wrong, it's been a while. Aren't normals only used for shading, lighting, texturing? Of course that will affect the skybox inside, so the normals should be facing inward. If you create the box manually, you can create one wall with clockwise vertices, then rotate it 90, 180, and 270 degrees around the y axis (making separate copies I mean) to form your other three walls. Then rotate (make separate copies) the front wall 90 degrees and -90 degrees around the x axis. This will automatically make the normals face toward you (assuming you don't use the Normal FVF property).

If you create the box in a separate program, it will probably think a cube should be closed and empty inside, therefore making the normals face outward and defining the vertices in the opposite direction than what you want. Maybe if you set the camera inside the box before exporting it, Milkshape is smart enough to know you want it's walls to be visible on the inside.

Chris

Share this post


Link to post
Share on other sites
Quote:
Original post by Supernat02
Correct me if I'm wrong, it's been a while. Aren't normals only used for shading, lighting, texturing?

In the fixed-function pipeline they are only used for vertex lighting. They don't pass through to the texture stages at all and has been mentioned they're not used for culling. (After all many vertex types don't have any normals.)

If you're using shaders then of course they're used however the vertex shader decides to use them.

Share this post


Link to post
Share on other sites

This topic is 4861 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this