Dynamic spherical mapping
Blitz3D Forums/Blitz3D Programming/Dynamic spherical mapping
| ||
Hi! I'd like to know if it's possible to do dynamic spherical mapping with blitz? if yes, How does it work? |
| ||
Dynamic? Well, I'm not sure if the texture filter is a dynamic form or if it's even true sphere mapping, but...Texture = CreateTexture(Width%,Height%,1+2+8+16+32+64) ;64 = Spherical environment mapping EntityTexture YourEntity,Texture,0,Layer% It works for me, but without a doubt you could write your own sphere-mapping function. |
| ||
I think he means like reflections. In that case, go with cube-maps. |
| ||
Although, if you check out my spinning cube demo on my site (link below) that uses dynamic sphere mapping. |
| ||
or even the demo in my sig |
| ||
I don't think that we talk about the same effect what I want to do is to create a effect like this www.planethalflife.com/screenshot.asp?src=/half-life2/screenshots/16.jpg you see the soldier upstairs, when he shoots there a dynamic light which is projected to the wall. I'd like to do this effect. Swift told me that it's a dynamic spherical lightmap. I'd like to know more about this effect! |
| ||
Now I know how Rob found out what I was doing. :-) |
| ||
I remember there was dynamic lighting that looked like that in the last singularity demo. |
| ||
Sorry to dig another old post the same day. Does anyone has the dynamic sphere mapping demo by Rob ? If yes, can you please share a fresh link or send it to my email address (see my profile) Thanks again ! :) |
| ||
I don't have it, but the technique itself is very simple: the texture that has the Spherical Environment flag gets overwritten every frame by a CopyRect call of the updated scene, like a CubeMap (except you're only doing one render, the back one). 1) Render a small viewport with the content you want to apply to the spherical texture (preferably looking back so it feels like a mirror); 2) CopyRect the backbuffer to the spherical texture; 3) Render the game view. The above per frame. |
| ||
Kryzon>>Ok thanks for the explanations. So it is like a mirror effect, i have already done that with Renderworld() + Copyrect() What i don't understand : 1)How a square texture made with Copyrect() can look good when a sphere map has a round shape (it seems the pixels at the corners are distorted to the middle of each side, see the spheremap which is with the teapot demo for example) 2)How the reflection can be correct, that is when you look at the mesh, the tris in front of the Camera reflect the Player and the environment correctly, knowing the UV coords of the vertices are put in different ways depending on how the UVMapping was done ? Thanks, |
| ||
The reflection won't be correct. I assume that in practice it relies on being used on complicated meshes which won't reflect a flat scene, and therefore the user won't be able to tell the difference because they can't actually see a whole reflected image, only that the reflections update in some fashion that matches the way the world moves. Spheremaps don't work on flat surfaces anyway, so you're rarely using them in a situation where the user is going to be able to tell. For flat surfaces you need a cubemap. The spheremap technique will probably be a lot more convincing if the reflection camera has a very wide FOV, near to 180 degrees, so that it can take in the side details that should be appearing at the edges of the map. You might be able to do some tricks with zooming that also distort the middle, bringing it closer to the real spheremap result. |
| ||
The spheremap technique will probably be a lot more convincing if the reflection camera has a very wide FOV, near to 180 degrees, so that it can take in the side details that should be appearing at the edges of the map. You might be able to do some tricks with zooming that also distort the middle, bringing it closer to the real spheremap result. Yasha>>Ok. I will try, thanks. But i think i will use precalculated cubemaps. |