Mapping one texture to another on terrain
by Bobby Leighton · in Torque Game Engine Advanced · 03/23/2007 (8:13 am) · 10 replies
How would I change the blender shader for mapping a detail texture to one of the textures in place. Even a quick hack would do, I can work out the rest later, Im just having trouble deciding what needs to be done, and after staring at so much code all night Ive lost myself somewhere...hehehe. please any help?
#2
But you have not specified what you want, there are 3 different and very different terrain types:
- Legacy
- Atlas2 blended
- Atlas2 unique
On Atlas2 Unique there is only a single texture beside detail, thats the unique.
and on legacy, there should already be the option in through the addMaterial calls in the material file where you could add it. Unless the functionality is only there to make it look like. (its the "detail: texturename.ext" block according the docs).
No idea what is possible with Atlas2 blended ... L3DT exporter does not support it right now so I don't use it.
03/25/2007 (12:15 am)
Yes I have.But you have not specified what you want, there are 3 different and very different terrain types:
- Legacy
- Atlas2 blended
- Atlas2 unique
On Atlas2 Unique there is only a single texture beside detail, thats the unique.
and on legacy, there should already be the option in through the addMaterial calls in the material file where you could add it. Unless the functionality is only there to make it look like. (its the "detail: texturename.ext" block according the docs).
No idea what is possible with Atlas2 blended ... L3DT exporter does not support it right now so I don't use it.
#3
03/25/2007 (12:56 am)
I've tried to get it working before but to no avail. What you should probalby do is take a single detail texture, and store an 8 bit greyscale detail in each channel, and then use one depending on the opacity map. Sounds easy, but haven't been able to make it work.
#4
03/25/2007 (4:20 am)
Ive been playing with the legacy terrain, figured id focus there on making the terrain looking good. im using a single square of legacy non-tiling, and then using Atlas2 for making mountains, and big massive lands. lets me break up the detail textures. But im talking about the legacy for the shaders:) thank you for answering in advance!!
#5
03/26/2007 (11:48 am)
Bump Bump............................:) Please....:)
#6
I.e. is it src + detail, multiple src + multiple detail? etc etc.
03/28/2007 (4:49 pm)
I'm still not understanding what it is you are wanting to do. Can you draw us a quick picture of how you want it to work (i.e. make an image of the source + final product in photoshop) so we can give you an idea.I.e. is it src + detail, multiple src + multiple detail? etc etc.
#7
[url]http://i129.photobucket.com/albums/p220/lmaceleighton/Example.jpg[url]
[image]http://i129.photobucket.com/albums/p220/lmaceleighton/Example.jpg[image]
If the bottom one doesn't work you can copy and paste if you need to but do you see what i circled?
I want to take the normal setup for legacy terrain, paint down the top textures like say on this island, if this was a crude top down view(which it is:P), and map or blend another texture to each of the ones already in place. Ive been going through my Directx books and im sure its possible but iam just starting with c++ and even though i recognize what most of the code does in the HLSL, im not to sure outside of changing number and using render-monkey, how to write my own stuff....yet:)
I guess it would be adding a separate detail map for each texture, or just texture blending. Ive been able to change the blender shader t make all available textures mix into one repeating texture, but that isn't very useful here:) thank you for all you consideration and patience in helping me!!
03/28/2007 (11:46 pm)
No problem:)[url]http://i129.photobucket.com/albums/p220/lmaceleighton/Example.jpg[url]
[image]http://i129.photobucket.com/albums/p220/lmaceleighton/Example.jpg[image]
If the bottom one doesn't work you can copy and paste if you need to but do you see what i circled?
I want to take the normal setup for legacy terrain, paint down the top textures like say on this island, if this was a crude top down view(which it is:P), and map or blend another texture to each of the ones already in place. Ive been going through my Directx books and im sure its possible but iam just starting with c++ and even though i recognize what most of the code does in the HLSL, im not to sure outside of changing number and using render-monkey, how to write my own stuff....yet:)
I guess it would be adding a separate detail map for each texture, or just texture blending. Ive been able to change the blender shader t make all available textures mix into one repeating texture, but that isn't very useful here:) thank you for all you consideration and patience in helping me!!
#8
03/28/2007 (11:53 pm)
I too have wanted to do this. I've tried through the blender without any luck. I don't think a shader approach would work well, honestly. You're going to have to do at least some editing in the terrain code.
#9
03/29/2007 (3:02 am)
Yes but it really shouldn't be that much, i understand what need to be there, just unsure where to put it, and where all the dependencies are...Ive come really close, i just need to know how to get extra fields so the shader will use other source textures I tell them to. When i do get this working im either just going to give it up as a resource or something:)
#10
(See what i did below this mess)
Right now im getting some......ummm..... well here is the print out of the log- (well the relevant part anyway)
Executing demo/client/scripts/shaders.cs.
E:\TGEA_\SDK\example\shaders\atlas\atlas.h(120): error X4000: variable 'OUT' used without having been completely initialized
GFXD3DShader::initVertShader - unable to compile shader!
E:\TGEA_\SDK\example\shaders\atlas\atlas.h(38): error X4502: invalid input semantic 'TEXCOORD8'
E:\TGEA_\SDK\example\shaders\atlas\atlas.h(120): error X4000: variable 'OUT' used without having been completely initialized
GFXD3DShader::initVertShader - unable to compile shader!
E:\TGEA_\SDK\example\shaders\atlas\atlas.h(38): error X4502: invalid input semantic 'TEXCOORD8'
E:\TGEA_\SDK\example\shaders\atlas\atlas.h(120): error X4000: variable 'OUT' used without having been completely initialized
GFXD3DShader::initVertShader - unable to compile shader!
E:\TGEA_\SDK\example\shaders\atlas\atlas.h(38): error X4502: invalid input semantic 'TEXCOORD8'
E:\TGEA_\SDK\example\shaders\atlas\atlasDetailV.hlsl(30): error X4000: variable 'OUT' used without having been completely initialized
GFXD3DShader::initVertShader - unable to compile shader!
E:\TGEA_\SDK\example\shaders\atlas\atlasBlenderPS20V.hlsl(41): error X3004: undeclared identifier 'IN'
GFXD3DShader::initVertShader - unable to compile shader!
E:\TGEA_\SDK\example\shaders\atlas\atlasBlenderPS20P.hlsl(51): error X3018: invalid subscript 'tex5'
Now Ive gone every where i can and looked up resources on adding more than one detail texture and i tried to use it to guide in at least getting it cool with the engine that it finds the other 3 detail textures where i told it, so the shader can tell it at runtime what exactly to do with them. RIGHT?:)(hope so)
Then instead of bringing the other detail textures in the atlas detailV.hlsl I put the connectors in the shaders in the Blender 2.0 one(atlasblender20...or something like this)( that's the one my card loads automatically) that way at the end, during the blend pass I can mix the detail texture with the texture already present through normal atlas2 methods(L3TD or what ever u use), if I need I will embarrass myself further and show the changes Ive made to engine as well as the shaders.
Thank you guys for helping me with this, if i can get this running and it works like i think it will there will be far less bitching in this community about textures on terrain:):):P
03/29/2007 (8:12 am)
The Atlas shaders didn't seem as hard to modify than the legacy ones, there is a lot of stuff for legacy that seems to be buried, so i went on to trying this with atlas rather then legacy seeing how there are a couple of resources out there that have changes that have to with a couple of the steps im trying to accomplish.(See what i did below this mess)
Right now im getting some......ummm..... well here is the print out of the log- (well the relevant part anyway)
Executing demo/client/scripts/shaders.cs.
E:\TGEA_\SDK\example\shaders\atlas\atlas.h(120): error X4000: variable 'OUT' used without having been completely initialized
GFXD3DShader::initVertShader - unable to compile shader!
E:\TGEA_\SDK\example\shaders\atlas\atlas.h(38): error X4502: invalid input semantic 'TEXCOORD8'
E:\TGEA_\SDK\example\shaders\atlas\atlas.h(120): error X4000: variable 'OUT' used without having been completely initialized
GFXD3DShader::initVertShader - unable to compile shader!
E:\TGEA_\SDK\example\shaders\atlas\atlas.h(38): error X4502: invalid input semantic 'TEXCOORD8'
E:\TGEA_\SDK\example\shaders\atlas\atlas.h(120): error X4000: variable 'OUT' used without having been completely initialized
GFXD3DShader::initVertShader - unable to compile shader!
E:\TGEA_\SDK\example\shaders\atlas\atlas.h(38): error X4502: invalid input semantic 'TEXCOORD8'
E:\TGEA_\SDK\example\shaders\atlas\atlasDetailV.hlsl(30): error X4000: variable 'OUT' used without having been completely initialized
GFXD3DShader::initVertShader - unable to compile shader!
E:\TGEA_\SDK\example\shaders\atlas\atlasBlenderPS20V.hlsl(41): error X3004: undeclared identifier 'IN'
GFXD3DShader::initVertShader - unable to compile shader!
E:\TGEA_\SDK\example\shaders\atlas\atlasBlenderPS20P.hlsl(51): error X3018: invalid subscript 'tex5'
Now Ive gone every where i can and looked up resources on adding more than one detail texture and i tried to use it to guide in at least getting it cool with the engine that it finds the other 3 detail textures where i told it, so the shader can tell it at runtime what exactly to do with them. RIGHT?:)(hope so)
Then instead of bringing the other detail textures in the atlas detailV.hlsl I put the connectors in the shaders in the Blender 2.0 one(atlasblender20...or something like this)( that's the one my card loads automatically) that way at the end, during the blend pass I can mix the detail texture with the texture already present through normal atlas2 methods(L3TD or what ever u use), if I need I will embarrass myself further and show the changes Ive made to engine as well as the shaders.
Thank you guys for helping me with this, if i can get this running and it works like i think it will there will be far less bitching in this community about textures on terrain:):):P
Torque 3D Owner Bobby Leighton