Texturemapped trapezoid

Blitz3D Forums/Blitz3D Programming/Texturemapped trapezoid

Lerc(Posted 2004) [#1]
I'm trying to make a texturemapped Trapezoid. Making a positional lightsource version of jfk's sunbeams effect. See http://www.blitzbasic.com/Community/posts.php?topic=35277

The problem is for non parallel rays you end up needing to texturemap a trapezoid. Not something you can do with Just U and V texture coords. I note that AddVertex does have a W parameter that is listed as for future use.

Any ideas?


jfk EO-11110(Posted 2004) [#2]
I tried exactly this, but I miserably failed. The problem is, a tris has only 3 vertices. If it had 4 of them, you could stretch any side of it as much as you want, but this way it's (at least for me) impossible. I decided to save the parallel one as a mesh, then load it in an app like 3ds Max and scale that part of the mesh using the EditMesh modifier.. I think this should work. Well, you could even model it in 3dsmax and then simply set the vertexalpha and UVs in blitz.

Check this out:
http://www.blitzbasic.com/Community/posts.php?topic=35304


Lerc(Posted 2004) [#3]
I'm not positive that the saved Mesh thing will work. Ultimately everything becomes a Triangle. The thread on reverse engineering the Blitz Structures has a mesh structure that only lists Texture U and V values stored for triangles http://www.blitzbasic.com/Community/posts.php?topic=27669

It is obvious that a card has the capability. a 3d projected quad is the same effect in 2d only with different Z values in eye space.

The trick is to incorperate the additional texture coordinates. It's getting into the nitty-gritty which is probably why Blitz didn't implement them. U and V are a lot easier to comprehend.

Have a look at http://www.r3.nu/~cass/qcoord/ for a look at it from an OpenGL perspective (pun not intentional).

For now I've copped out and have gone for parallel projected rays. Much like yours but with movable light sources.


jfk EO-11110(Posted 2004) [#4]
thanks. although the expanding shape looks better, parallel projected rays would be more natural, assuming we are talking about sunlight.

But you still can use an expanding shape when you use only vertical shapes, or horizontal ones. One thing that made me wondering was I just replayed hitman 2 once again yesterday and went into the church to watch the effect again. First, there are only vertical quads. They have that expanding shape, I wonder how they did it, maybe they really used a seperate texture for each quad(?) Well, that would make it easy, simly paint some distported rays on a 265*256 texture and uv-map it plain 2d. Probably they really did it this way since it is kind of suspicous that they use the same window 3 times. Additionally I want to mention that the churchwindows, stained glass thingy, in hitman 2 is indeed much smoother than my example, probably blurred, or using a small texture (64*64 or someting). They use 4 vertival quads only. But in the subway there are diffrent ray meshes, animated ones, and they project some patterns onto the moving water as well.