Two new auto GPU parameters

What it says on the tin: a place to discuss proposed new features.
Post Reply
Grigory
Gnoblar
Posts: 11
Joined: Wed Apr 30, 2008 4:06 am

Two new auto GPU parameters

Post by Grigory »

I've found several situations (within shaders) where it would be really helpful to have the world transform matrix of the object's *parent*, and for symmetry, the local transform matrix of the object. I suppose it is a bit of an esoteric request, and I'll probably have to implement it myself if I have time, but it would still be nice to have these. I have no idea how to make a patch, or access the SVN, or anything like that.

The reason I ask is because I'm trying to set up an interface that is easy for the other developer in my team to use, without having to constantly update matrices. My scenario is a bit hard to explain, so I'll present a simpler example.

Imagine you have a canal, with boats in in. The canal has a scenenode, and each boat has it's own scenenode, attached/parented to the canal's scenenode. Now say you want to apply a sin curve to the height of the boats in the canal to quickly simulate the boats bobbing up and down on the water. You can't use the boat's local mesh coordinates, otherwise all the boats would have the same height. You can't use the world coordinates, as you want the distance down the length of the canal, and it could be orientated/scaled/translated in an arbitrary way. Also, pretend you have to do it in the vertex shader because the CPU is way too slow. The only way (that I can see) is to find the boat's coordinates in the canal's space, then you could just take the x-axis value and apply a sin function to it to determine the height offset. To find the coords in the parent's space would require the local transform matrix of the object.

Sorry if that wasn't very clear, I can't think of a simpler scenario that illustrates the need for these parameters. I'm not really sure if anyone else would have a need for it, but it seems like a relatively straightforward addition to the Ogre code for someone who knows it well, which I don't. If someone could put these into the next release, that would really help me out, thanks!
Post Reply