Nice cubic mapping function
Blitz3D Forums/Blitz3D Programming/Nice cubic mapping function
| ||
I am not sure if this is precisely cubic mapping, but it looks darn good on flat surfaces. The whole key here is that your vertex normals need to be right. One face of an object should have all the normals in the same direction, or else you get ugly stretching like when you use sphere mapping on a flat surface. I really recommend viewing this demo first: http://www.leadwerks.com/storage/shiny.zip Function cubicmapvertex(surf,v,cam,verts=1) x#=EntityX(cam) y#=EntityY(cam) z#=EntityZ(cam) pitch#=EntityPitch(cam) yaw#=EntityYaw(cam) roll#=EntityRoll(cam) RotateEntity cam,0,0,0 AlignToVector cam,VertexNX(surf,v),VertexNY(surf,v),VertexNZ(surf,v),3 RotateEntity cam,EntityPitch(cam),EntityYaw(cam),0 TFormPoint 0,0,0,0,cam tx#=TFormedX() ty#=TFormedY() TFormPoint VertexX(surf,v),VertexY(surf,v),VertexZ(surf,v),m,cam tz#=TFormedZ() If tz<100 tz=100 VertexTexCoords surf,v,((TFormedX()-tx/5.0)/tz)/2.0,((TFormedY()-ty/2.0)/tz)/5.0,0,1 PositionEntity cam,x,y,z RotateEntity cam,pitch,yaw,roll End Function |
| ||
"User lib not found". You have one required DLL in your userlibs folder. |
| ||
Halo, you make me tired. |
| ||
I added water, with rippling cubic reflections. It's the best water i have ever seen in Blitz, perhaps the best i have seen in any game. Same download, source included. |
| ||
Yeah, it's good. |
| ||
very cool indeed |
| ||
very nice but whats this Vextorx() command not included in teh sourcecode? |
| ||
Looks really good ^_^ The effect makes everything feel very chrome, and combined with sphere mapping for other objects I'm sure it could look incredibly striking. Great work! |
| ||
I included the vector3d lib. You should be able to run the source. |
| ||
Framerates? I get the maximum framerate on my system, but I'd like to hear how it is doing on lower-spec systems. |
| ||
It looks really lovely, but I'm only getting 30 FPS here. P4 1400 with geforce2 pro. |
| ||
How about changing the water detail until you find the maximum detail where your system still runs at its fastest. The detail of the water can be controlled with CreateQuad(1000,50), where 50 indicates that the water is 50x50=2500 quads. (I can go to about 10,000 quads with no slowdown, or a detail level of 100.) This really is meant as a practical, usable effect for games. The cubic mapping itself, without the water, should be so fast that it doesn't matter how much you use it. |
| ||
I can't compile the bb - vectorx (and I assume vectory and vectorz) function not found. I guess you made this in your own ide, and forgot to include a lib? |
| ||
There's a .decls userlib thing in the archive -- stick it in your userlibs folder... |
| ||
"I added water, with rippling cubic reflections. It's the best water i have ever seen in Blitz, perhaps the best i have seen in any game. Same download, source included." sounds interesting, of to d/l it now, thanks halo. |
| ||
Nice demo and the water looks good. Not sure what I think about the wall mapping tho, looks nice when you move sideways, but strange when you move in/out. It runs at about 30 fps on mine (faster in fullscreen). Changing the water quad detail makes only a little difference to the speed. If I change the 50 to a 5 I get 10 more FPS (in fullscreen). I'm not sure the water is the best I've ever seen, (limiting myself to water in 'realistic' games) the water in OutCast takes some beating. And, the flowing water in Vietcong is pretty good. |
| ||
I'll check those out. Yeah, the reflections move when you move in and out, and they should just scale. I'm sure it will get better. The cubic mapping alone is super-fast, right? |
| ||
The line: cubemap map takes 10 millisecs every frame on my setup. Which is quite intensive. That is the thing slowing down the most. The water with a setting of 50 takes 9 millisecs, but only 1 if I knock the setting down to 5. |
| ||
Oh a userlib. Okay. Never used one o them before. |
| ||
Would this technique be possible on an animated model? Is it possible to adjust the normals of a model to point vertically each frame, and would this be processor intensive? |
| ||
it's not possible with a deforming animated model unless you grab a list of frame normals. It's always processor intensive. |