SETCUBEMODE

Blitz3D Forums/Blitz3D Programming/SETCUBEMODE

Naughty Alien(Posted 2006) [#1]
well..I cant find any help within cBlitz3D ommand reference docs, so, can anyone post here whole command set list for this??


Matty(Posted 2006) [#2]
http://www.blitzbasic.com/b3ddocs/command.php?name=SetCubeMode&ref=3d_a-z

EDIT - I'd never seen this command either...although have never used a cube map so wouldn't have had a need to.


RemiD(Posted 2016) [#3]
11 years later... i have not found any post about what i am trying to achieve... (texels lighting/shading using cubemap textures (for turning moving entities like characters, vehicles), and setcubemode 2 seems to e what i am looking for...


Bobysait(Posted 2016) [#4]
SetCubeMode is the function that set the automatic projection mode of the cubemap texture
-> it operates like a standard texture with the SPHERICAL flag that forces the UVs of the mesh to skip the surface's texture coordinates and replace them with some UVs based on the normal of the triangle in screen space

the cubemode allow 3 modes pretty similar to what the spherical mapping does :
- specular
- diffuse
- reflection
And, thoose 3 modes are just replacement names for the 3 modes from Dx for automatic texture coordinates

(have a look on the definitions here)
https://msdn.microsoft.com/en-us/library/windows/desktop/bb172339(v=vs.85).aspx

Just replace the specular,diffuse and reflection with something like :
- specular = D3DTSS_TCI_CAMERASPACENORMAL
- diffuse = D3DTSS_TCI_CAMERASPACEPOSITION
- reflection = D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR


Kryzon(Posted 2016) [#5]
Hi Boby. I think the association is different:
Specular mode = D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR = like a specular reflection (mirror-like), it's the eye-to-vertex vector reflected by the vertex normal. Gives a shiny appearance.

Diffuse mode = D3DTSS_TCI_CAMERASPACENORMAL = like projecting the cubemap on the object, the cubemap is sampled directly by the vertex normal.

Refraction ("cloak") mode = D3DTSS_TCI_CAMERASPACEPOSITION = the cubemap is sampled by the eye-to-vertex vector, which mostly passes through the mesh and gives this invisible cloak effect since you can see the environment "in front" of the mesh.

The above was mostly by observation, but the source code suggests the same:
- https://github.com/blitz-research/blitz3d/blob/647f304ef81387d8235b084bb1d9cb7ba5ff139e/gxruntime/gxcanvas.h#L77
- https://github.com/blitz-research/blitz3d/blob/647f304ef81387d8235b084bb1d9cb7ba5ff139e/gxruntime/gxscene.cpp#L155

(And there's a hidden cube mode 4 which gives a slightly different result than the specular mode. I have no idea what it does differently, but if you try it in Blitz3D it happens.)


Bobysait(Posted 2016) [#6]
You're absolutely true, I associated by name and in the order they were written, but without checking


RemiD(Posted 2016) [#7]
after some tests :
->setcubemode 1 is like a mirror effect (it shows what is in front of the face, in the direction of the face)
->setcubemode 2 is like a see through effect (it shows what is behind the face, in the opposite direction of the face)

but for setcubemode 2, i have no idea what it does....