Detail Mapping for .dif interiors
by Nicolas Quijano · 04/08/2004 (8:59 pm) · 38 comments
Download Code File
Edit : removed obsolete URL, wording, typos
Works with HEAD as well as older versions, as the changes are very limited. If you haven't modified the material mapping system or the interiors, you can simply backup your copy of the affected files, and just install these in their place, rebuild TGE, and you'll be ready to add detail textures to your difs.
Detail texturing is done by adding a material mapping by binding a detail texture to a normal interior texture.
You can specify an alpha factor value between 0.0 and 1.0 for each mapping, as the last parameter.
A value of 1 will make the detail texture completely opage, meaning it will hide the base texture completely.
At this point, using a .png texture with an alpha channel leads to unpredictable results, so unless you like the results, don't use an alpha channel .png as your detail map.
I strongly recommend using a detail texture of the same size as your base texture, or even bigger. Beware of tiling patterns becoming more apparent in both textures : it drives the points even more that you should break big walls and surfaces into multiple pieces while modelling :)
It also darkens the surface a little, as you have to remember that .difs are also light by texturing with lightmaps, which are blended with the base texture. Then, the detail map is applied.
example :
Affected files are :
dgl/materialPropertyMap.h
dgl/materialPropertyMap.cc
interior/interior.h
interior/interior.cc
interior/interiorInstance.cc
interior/interiorRender.cc
Not sure about future plans for this resource, although there is a good chance I'll work on some improvements for it.
Big thanks to John Kabus, from synapsegaming for getting me on the right track :)
Hope it can help a few torquers out there,
Enjoy :)
Edit : removed obsolete URL, wording, typos
Works with HEAD as well as older versions, as the changes are very limited. If you haven't modified the material mapping system or the interiors, you can simply backup your copy of the affected files, and just install these in their place, rebuild TGE, and you'll be ready to add detail textures to your difs.
Detail texturing is done by adding a material mapping by binding a detail texture to a normal interior texture.
You can specify an alpha factor value between 0.0 and 1.0 for each mapping, as the last parameter.
A value of 1 will make the detail texture completely opage, meaning it will hide the base texture completely.
At this point, using a .png texture with an alpha channel leads to unpredictable results, so unless you like the results, don't use an alpha channel .png as your detail map.
I strongly recommend using a detail texture of the same size as your base texture, or even bigger. Beware of tiling patterns becoming more apparent in both textures : it drives the points even more that you should break big walls and surfaces into multiple pieces while modelling :)
It also darkens the surface a little, as you have to remember that .difs are also light by texturing with lightmaps, which are blended with the base texture. Then, the detail map is applied.
example :
addMaterialMapping("cement_wall", "detail: fps/data/interiors/scratches.png 0.5");Affected files are :
dgl/materialPropertyMap.h
dgl/materialPropertyMap.cc
interior/interior.h
interior/interior.cc
interior/interiorInstance.cc
interior/interiorRender.cc
Not sure about future plans for this resource, although there is a good chance I'll work on some improvements for it.
Big thanks to John Kabus, from synapsegaming for getting me on the right track :)
Hope it can help a few torquers out there,
Enjoy :)
About the author
Veteran and even a casualty of the mainstream game industry, as well as one of the early adopters of GG's tech : did the first builds of Orbz for MacOS X. A (great) Old One? And like one of 'em Cthonic thingies, from a great slumber or depths, I rise...
#22
That's just odd.
I'll just put it back as a url then, that works.
04/11/2004 (2:01 pm)
It's our own server, and the domain is just a forwarder.That's just odd.
I'll just put it back as a url then, that works.
#23
Edit : made an error in the recommendation that was given here.
04/12/2004 (8:27 am)
Guys, the detail texture gets loaded like a normal texture, so yes, it keeps its colors, etc. That's intentional :)Edit : made an error in the recommendation that was given here.
#24
I'll test this out now and post when I have some results.
Edit:
No difference as far as I'm noticing @ least :/ I'm following the test of this:
Add detail1.png as a detail texture on top of oak2. Expecting result of the oak2 texture (as per my screenshot above) to still be brown, but appear to eb quite rough cos the detail1.png should be giving it lots of highlights and lowlights. Primarily, it should still be brown ;)
04/12/2004 (9:13 am)
aha ;)I'll test this out now and post when I have some results.
Edit:
No difference as far as I'm noticing @ least :/ I'm following the test of this:
Add detail1.png as a detail texture on top of oak2. Expecting result of the oak2 texture (as per my screenshot above) to still be brown, but appear to eb quite rough cos the detail1.png should be giving it lots of highlights and lowlights. Primarily, it should still be brown ;)
#25
I released this so people can't either use it as is, so they can add a bit of detail to their interior surfaces, but also as a practical example on how to extend the current system.
As I remark, it's far from perfect, and more of a hack than anything else :)
Use, abuse it, do what you will ;)
04/12/2004 (1:40 pm)
As I also say in the little text file, it does not support an alpha channel in the detail texture. The alpha value controls the transparency of the whole texture : at 1, you don't see the texture underneath anymore... I released this so people can't either use it as is, so they can add a bit of detail to their interior surfaces, but also as a practical example on how to extend the current system.
As I remark, it's far from perfect, and more of a hack than anything else :)
Use, abuse it, do what you will ;)
#26
;)
Edit: More like, when I shoot with the weapon in the picture it creates a dynamic light at hit, much like the original crossbow example in Realm Wars. This lit up the whole face.
04/13/2004 (12:12 am)
Nicolas: I think you missed half of the point though; If you apply a light to the texture, a dynamic light, (whatever) the whole face get's lit up and it's not really looking Torque anymore :P More like Wolfenstein 3d.;)
Edit: More like, when I shoot with the weapon in the picture it creates a dynamic light at hit, much like the original crossbow example in Realm Wars. This lit up the whole face.
#27
1. How to change size of the detail texture? It's stretched and does not look detailed...
2. In those places where light from the sun gets, detailed texture is not visible.
04/14/2004 (12:56 pm)
Help!1. How to change size of the detail texture? It's stretched and does not look detailed...
2. In those places where light from the sun gets, detailed texture is not visible.
#28
A good bet is that Nicolas isn't checking this resource anymore, I would approach him more directly if I were looking for answers.
04/17/2004 (10:38 am)
DgdsfgA good bet is that Nicolas isn't checking this resource anymore, I would approach him more directly if I were looking for answers.
#29
04/17/2004 (11:11 am)
Excellent addition; thanks
#30
I have to change a few things for this to work :)
I'll update the resource as soon as it works.
05/04/2004 (10:52 am)
I'm still working on adding some blending control to the ressource. I have to change a few things for this to work :)
I'll update the resource as soon as it works.
#31
08/21/2004 (10:26 am)
I've hijacked this resource and used it to hack in bump mapping via cg if any one is interested...GREAT resource nick..
#32
Looks pretty good there Kev, wouldnt mind checking it out myself!
08/24/2004 (2:52 am)
*jaw drops*...Looks pretty good there Kev, wouldnt mind checking it out myself!
#33
08/24/2004 (2:41 pm)
who ever made that texture already had normal maps in mind..
#34
I'm very glad that you've found it useful
09/11/2004 (7:05 pm)
Nice work Kevin :) Don't give me too much credit 'though, everything was already there, it was just matter of setting it up. I'm very glad that you've found it useful
#35
09/14/2004 (11:23 am)
All I see that is happening is that the detail texture is overlayed on top of the other texture. I have no blending going on what so ever. I also see that the texture will flicker as you move around it. Has someone came up with a fix for this?
#36
Anyone?
09/24/2005 (6:08 pm)
I have merge this resource with 1.4, but it doesnt work. Textures lost lightmap when I use it, and I dont see any detail texture.Anyone?
#37
12/14/2005 (3:07 am)
bump
#38
05/15/2006 (6:39 am)
Has anyone get it to work with 1.4? 
Associate Craig Fortune
Hmm your image isn't linking, does your domain not allow hotlinking?