Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    27
  • comments
    25
  • views
    6375

GPUPhysics: A hell with shaders

Sign in to follow this  
fortia

112 views

Today I began implementing the shaders for GPUPhysics and discovered a lot of limitations that were sooo annoying.

For example the fact that you cannot have a sampler array that you index with a variable. I was totally counting on that (and it's very important to get it working), but as it seems I will have to find a way around the problem. Any tips would be greatly appreciated. Currently I'm doing it this way as a walk-around (compiling with ps_3_0, HLSL):


//...
//tex_shapes is an array of 10 samplerCUBEs
int a = anything;
for(int i=0;i<10;i++)
{
if(i==a)
lala = texCUBE(tex_shapes,texcoord);
}
//...






But this generates a LOT of assembly code [sad]... there's got to be a better way! I want to have the appropriate indices stored in a texture and look them up (rounded to integers).

Another way I thought of is using 6 volume textures that have 10 layers. Each of these volume textures would be a set representing one cube side. Then I would do some kind of fake cube-texture lookup using a depth texture coordinate instead of an index to access the right layer. This would actually be good in the sence that I could have more than 10 layars if I like to (the number of 10 was chosen due to 16 textures limitation on Shader Model 3). But the problem is, that I don't know how to do this fake cube texture lookup.
To simplify the case: Imagine we have only 6 2D textures representing the sides of a cube map. How could I do a "cubemap lookup" using these instead of a real cubemap? I guess that's the problem of tomorrow, now I'm going to bed...

[dead]
Sign in to follow this  


1 Comment


Recommended Comments

Have been away in Stockholm at a course, and was ill a few days. (This is for my own record only...)

Share this comment


Link to comment

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
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!