Sign in to follow this  
CadeF

Creating a deformed sphere

Recommended Posts

Hey everyone, In my engine, the final check (after octree and frustum) if a point light is visible, is to occlusion query it's light mesh (Sphere with the radius of the point light). But if it has a large radius, and is in a corridoor, the actual mesh is larger than the corridoor, so I waste time rendering a light that passes the occlusion test, but can't affect the visible scene. Is there anyway I can deform this mesh at load time? I was thinking of tracing rays from the center, to end up with something like this. Does anyone have any idea about how I would go about doing this? Thanks.

Share this post


Link to post
Share on other sites
what about testing of light affection sphere(eg. sphere with radius equal when color affected with light is nearly zero)in frustrum.

Share this post


Link to post
Share on other sites
Okay, this might be a dumb answer but ... can't you just select 'brushes' (in BSP terms) close to the light (i.e. within its radius), and clip the sphere by each plane that faces it? Clipping a convex mesh by a plane is quite easy as long as the origin of the mesh isn't clipped out, which it won't be unless you've put your light inside a wall.

Share this post


Link to post
Share on other sites
Falhar - Your method sounds a bit long
Bob Janova - Clipping against planes would result in a convex deformed mesh. If you see the screenshot, it is concave.

Right now, what Im doing is to use D3DX and create a sphere,
-lock
for each vertex
trace a ray to the center
if the ray trace fails
set the vertex position to the ray hit point
-unlock.

But I'm wondering if there are other ways to do this.

Share this post


Link to post
Share on other sites
Yes, that's true. If a convex approximation of the mesh is not good enough, then you have to do what you described, which is effectively clipping the spherical mesh to each face (or, equivalently, brush) that it intersects.

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