Environment Mapping not using shaders

Started by
13 comments, last by GambitSnax 18 years, 1 month ago
I was wondering if anyone could explain to me in detail the process required to perform cubic and spherical mapping in directx 9 without the use of shaders. I have had a look at some topics on this issue already on the forum and they seem to gloss over this a little to briefly for me too understand properly how to get it to work. At the moment my environment mapping works through a shader. I am rendering default D3DXMesh objects inside a custom made cube that displays the skymap on it. The skymap is fed into the shader through a .dds file. Any help would be greatly appreciated. Cheers.
Advertisement
If I haven't given enough information about a certain area just let me know.

Thanks
Don't know about spherical mapping. Cubic mapping is just rendering the scene from 6 angles into 6 textures. You can do this directly or use the D3DX helper functions and a cube-map texture to make ita little easier.
Ahh yes I had looked over those functions before, but had had a little trouble mapping those surfaces to the environment map.

I know for spherical mapping you can use TSS_TCI_SPHEREMAP and for cube mapping TSS_TCI_CAMERASPACEREFLECTIONVECTOR is supposed to be used some how. But i'm not sure how it works...
MSDN has good info on both.

Hope this helps.
Sirob Yes.» - status: Work-O-Rama.
Still having a few problems...
Can I use the meshes generated from the D3DXCreateSphere etc. functions? or do I need to set up my own vertex buffers?

after I make this call..

g_pD3DDevice->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR | 0);

do I then call set texture and pass in the cube map? or do I do it before hand?

I am creating my cubemap via the function...

D3DXCreateCubeTextureFromFile(g_pD3DDevice, "ddsCubemap.dds", &g_pCubeMap);
where the .dds file contains each of the viewports of the cubemap layered out in the classic 'cross' environment style.

and when I was searching around I also found this function,

g_pD3DDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT3);

could someone explain to me what it means?

oh, and am I right in thinking that lighting isn't necessary as the object is being textured?

cheers :)
Ok
I got the environment mapping working for cubic mapping. Cheers for the help.
Just a few questions -

Using the D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR seemed to be all that was required to get the environment mapping to work. Am I right in thinking D3DTSS_TEXTURETRANSFORMFLAGS is used to ensure the environment moves as you move the camera? Could someone explain why cubic mapping uses the variable D3DTTFF_COUNT3 and spherical mapping uses the variable D3DTTFF_COUNT2?
I understand it has something to do with the number of texture variables being passed into the object but don't understand the specifics.

I'm starting to work on the spherical mapping now. Could someone suggest a program that will allow me to generate spherical maps from cubic maps? The actual texture files I mean.

Cheers in advance.
Quote:Original post by GambitSnax
Could someone explain why cubic mapping uses the variable D3DTTFF_COUNT3 and spherical mapping uses the variable D3DTTFF_COUNT2?
I understand it has something to do with the number of texture variables being passed into the object but don't understand the specifics.


Cube maps require 3-dimensional coordinates to look up a value (cartesian coordinates). Sphere maps only require 2-dimensional coordinates (polar coordinates).

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

Thanks for the info superpig. Makes sense now.

Just again, does anyone know a program that will help me generate sphere maps? Or a place where I can download them? Is there a photoshop plugin or something that will help?

Cheers.
I made my own spheremap making program, it is better because you can do what you want with it. I tried doing the cube map but i got fed up and stopped, in stead i did spheremap. But i still need to find out. Could you show me how you did it? Essential code parts?

This topic is closed to new replies.

Advertisement