Sign in to follow this  
WilliamWyattEarnshaw

Inside-Out Sphere

Recommended Posts

Ok, original post is below, but skip down a couple posts to the one with pictures to get a better understanding of the issue.

-----------------------------------------
I am working on a project and have run into a problem. I want the entire game to take place inside of a spherical arena. I am using a very simple rendering process because I am not very familiar with C++ and Direct X but I am still unable to accomplish this.
I am using a simple mesh, D3DXCreateSphere(d3ddev, 1, 20, 20, &sphereMesh, NULL); and my initial idea was to just draw another sphere the size I wanted the arena, namely at a scale of -10.0f or whatever. The problem is when I begin to use point lights in this program they behave very strangely with the mesh. I have the renderstate set to normalize the normals, but the problems appears to be that the normals are facing the wrong direction. When the light is very close to an edge, it illuminates it as if it were far away, and when it is near the center of the sphere, the closest side is illuminated as if the light were right next to it.
If I am right, I must get a sphere with the normals pointing in the opposite direction, namely towards the center of the sphere.
I have been unable to do this. I have tried to find the code for D3DXCreateSphere() to alter it, but I have not been able to find it. I have tried repositioning the light when drawing the arena, but I would need to reposition it to infinitely many positions outside of the sphere to reproduce the effect of a light being inside of it, which clearly would not work.
I need a mesh with the normals pointing radially inwards, but I do not know how to do this. Code-wise, or building another mesh in another program and loading it in, I somehow need a mesh of an inside out sphere.
Can anyone help me out with this?

Share this post


Link to post
Share on other sites
zacaj    667
Why are you scaling by a negative number? That will flip it, not just scale it, which WOULD reverse the normals. AMaybe you want .1? I may be reading your post completelly wring though

Share this post


Link to post
Share on other sites
Maybe I am wrong in my assessment then. I have tried making the arena sphere a +10 scale and then reversing the cull mode so I can see inside of it, but the lighting still looks very strange. :(
I want the point light to illuminate the entire inside of the sphere, but it seems to only illuminate one bit at a time. Strange things appear to happen when you place a light inside of a mesh.

Share this post


Link to post
Share on other sites
I added a small red sphere to mark the position of the light and discovered I was very wrong in my thoughts as to what was happening. Anyways, here are some pictures.
[attachment=2821:temp.jpg]
In this picture it shows the light inside of the "arena." It is not illuminating the arena at all.
[attachment=2822:temp.jpg]
And here is a picture showing the light outside of the arena, illuminating it as usual.

I need the light to illuminate the inside of the sphere. How do I do this?

Share this post


Link to post
Share on other sites

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