Cubemaps on .DTS models
by Lorne McIntosh · in Torque Game Engine Advanced · 04/15/2008 (11:37 am) · 10 replies
Has anyone successfully managed to create a .dts model with a cubemap on it working in game? I have managed to get cubemaps working on .dif files but am having trouble creating one on a .dts mesh. Is it possible to map a cubemap onto a .dts?
About the author
Ubiq Visuals is a software and creative content developer for the entertainment industry. Our vision is to provide inspiration and the tools for soon-to-be game designers and creative minds of all ages.
#2
05/02/2008 (11:46 am)
Yes I understand what a cubemap is. I had a non-dynamic cubemap working on .dif objects and was having trouble getting it to work on .dts models but I have it working now. It just didn't seem to want to work on a particular .dts I was using for some reason...
#3
Havent tested Dynamic Cubemapping though.
06/18/2008 (3:52 am)
I have it working in TGEA 1.0.2 and TGEA 1.7.Havent tested Dynamic Cubemapping though.
#4
I'm making a mirror that I want to be able to move ingame (otherwise I could just use planarReflection on a *.dif if I'm not all wrong here).
Settings:
datablock StaticShapeData( Mirror )
{
category = "ShaderTest";
shapeFile = "~/data/shapes/old_town/mirror.dts";
dynamicReflection = true;
};
new CustomMaterial(mat_mirror)
{
mapTo = "mirror";
texture[0] = "$dynamicCubemap";
shader = Reflect;
version = 2.0;
};
Anyone got any suggestions or tips to solve this *moving mirror* problem?!
Using TGEA 1.7.1...
10/09/2008 (7:56 pm)
Got dynamicCubemap to work?! It seems to smash my engine on load at least...I'm making a mirror that I want to be able to move ingame (otherwise I could just use planarReflection on a *.dif if I'm not all wrong here).
Settings:
datablock StaticShapeData( Mirror )
{
category = "ShaderTest";
shapeFile = "~/data/shapes/old_town/mirror.dts";
dynamicReflection = true;
};
new CustomMaterial(mat_mirror)
{
mapTo = "mirror";
texture[0] = "$dynamicCubemap";
shader = Reflect;
version = 2.0;
};
Anyone got any suggestions or tips to solve this *moving mirror* problem?!
Using TGEA 1.7.1...
#5
May be the problem is the StaticShape class.
I found that static objects (TSS also) do not render dynamic cubemaps.
I have it working on an Item object right now.
10/10/2008 (11:04 am)
Yes,it is working since TSE.May be the problem is the StaticShape class.
I found that static objects (TSS also) do not render dynamic cubemaps.
I have it working on an Item object right now.
#6
I've also tried it with this a *standard* material;
new Material(mat_mirror)
{
mapTo = "mirror";
baseTex[0] = "mirror";
dynamicCubemap = true;
};
Any thoughts?
10/11/2008 (7:53 am)
Tried to change my datablock to an ItemData instead of a StaticShapeData....but it still crash the engine on add.I've also tried it with this a *standard* material;
new Material(mat_mirror)
{
mapTo = "mirror";
baseTex[0] = "mirror";
dynamicCubemap = true;
};
Any thoughts?
#7
Found this;
www.garagegames.com/mg/forums/result.thread.php?qt=79231
10/11/2008 (8:18 am)
Tried with TGEA 1.7.0 also...still crash.Found this;
www.garagegames.com/mg/forums/result.thread.php?qt=79231
#8
datablock ItemData( Mirror )
{
category = "ShaderTest";
shapeFile = "~/data/shapes/old_town/mirror.dts";
dynamicReflection = true;
};
// Try to add the item directly in your mission file, copy the code below
new Item( Mirror )
{
//add position,rotation,scale optional
datablock = "Mirror";
};
Use Custom Material.
Chech your shader for errors.
Chech the cubemap sampler first (use samplerCUBE/texCUBE).
edit-not tested in the new 1.7.1, i just downloaded it and will try it soon.
10/11/2008 (9:20 am)
//here is your datablockdatablock ItemData( Mirror )
{
category = "ShaderTest";
shapeFile = "~/data/shapes/old_town/mirror.dts";
dynamicReflection = true;
};
// Try to add the item directly in your mission file, copy the code below
new Item( Mirror )
{
//add position,rotation,scale optional
datablock = "Mirror";
};
Use Custom Material.
Chech your shader for errors.
Chech the cubemap sampler first (use samplerCUBE/texCUBE).
edit-not tested in the new 1.7.1, i just downloaded it and will try it soon.
#9
I'm using the ReflectShader that comes with TGEA (and which works with 1.0.3, but seems to crash 1.7.x).
// Structures
//-----------------------------------------------------------------------------
struct ConnectData
{
float3 cubeNormal : TEXCOORD0;
float3 cubeEyePos : TEXCOORD1;
float3 pos : TEXCOORD2;
};
/*
struct ConnectData
{
float3 reflectVec : TEXCOORD0;
};
*/
struct Fragout
{
float4 col : COLOR0;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
Fragout main( ConnectData IN,
uniform samplerCUBE cubeMap : register(S0)
)
{
Fragout OUT;
float3 eyeToPix = IN.pos - IN.cubeEyePos;
float3 reflectVec = reflect(eyeToPix, IN.cubeNormal);
OUT.col = texCUBE(cubeMap, reflectVec);
OUT.col = OUT.col + float4( 0.0, 0.0, 0.1, 0.0 );
/*
OUT.col = texCUBE(cubeMap, IN.reflectVec);
OUT.col = OUT.col + float4( 0.0, 0.0, 0.2, 0.0 );
*/
return OUT;
}
Any ideas?
10/11/2008 (9:52 am)
I think I've set it all up right...but it's quite hard to debug since I'm not coding and can't step through the code for errors...and the engine crashes when adding this Item.I'm using the ReflectShader that comes with TGEA (and which works with 1.0.3, but seems to crash 1.7.x).
// Structures
//-----------------------------------------------------------------------------
struct ConnectData
{
float3 cubeNormal : TEXCOORD0;
float3 cubeEyePos : TEXCOORD1;
float3 pos : TEXCOORD2;
};
/*
struct ConnectData
{
float3 reflectVec : TEXCOORD0;
};
*/
struct Fragout
{
float4 col : COLOR0;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
Fragout main( ConnectData IN,
uniform samplerCUBE cubeMap : register(S0)
)
{
Fragout OUT;
float3 eyeToPix = IN.pos - IN.cubeEyePos;
float3 reflectVec = reflect(eyeToPix, IN.cubeNormal);
OUT.col = texCUBE(cubeMap, reflectVec);
OUT.col = OUT.col + float4( 0.0, 0.0, 0.1, 0.0 );
/*
OUT.col = texCUBE(cubeMap, IN.reflectVec);
OUT.col = OUT.col + float4( 0.0, 0.0, 0.2, 0.0 );
*/
return OUT;
}
Any ideas?
#10
I took a look at the custommaterial class and found that setStageData is missing (at a first sight).
And i am sure the dynamic cubemap is not the only thing missing.
Try to restore it, i think the whole principle is still present.
10/11/2008 (11:12 am)
The shader seems OK.I took a look at the custommaterial class and found that setStageData is missing (at a first sight).
And i am sure the dynamic cubemap is not the only thing missing.
Try to restore it, i think the whole principle is still present.
Torque Owner Ivan Mandzhukov
Liman3D
If you have used Conitec engine they did the cubemap as a single texture, then cut a part of it, that represent a single plane of the cube.
The cubemaps are not intended for simple diffuse mapping BTW.