by date
TGE Detail maps (let's fix it)
TGE Detail maps (let's fix it)
| Name: | Apparatus | ![]() |
|---|---|---|
| Date Posted: | Jun 22, 2008 | |
| Rating: | 4.3 out of 5 | |
| Public: | YES | |
| Comments: | YES | |
| RSS Feed: | or Subscribe with . | |
| Profile Page: | View profile page for Apparatus |
Blog post
I know detail map code is in there, Milkshape exporter has (had?) it, Lightwave exporter has it (complete with detail scale), 3dsMax (version 8 tested) exporter has it if you add the detail texture in the Ambient slot of the material. Yet in Torque no detail maps show up..
I recon it is not so important for many people but sometimes it really makes the difference; In TGE a small / medium object with a proper diffuse map could look great; in TGEA the fancy normal mapping and specular make indeed wonders. What if you run into a problem when you really could use a good ol' trick?
I was making these huge mountain bits and since the textures are relatively perfect for the job one may think it was enough. Well, it isn't : ) TGE recommends a maximum resolution of 512x512. On current hardware, 1024x1024 can be used here an there with no problem at all. I can't say about TGEA cause I don't have it / never looked into the issue.
The following example has a good 1024x1024 texture estate (with a bit of repeating as well) and should provide enough detail and it does, as looking at it from a distance ; On a close up however, we got ourselves a huge chunk of the screen covered with this dull blurred texture. And we really need some detail there since the player is about 2 m high (and that's about half the square zoomed region).
no detailmap whatsoever:

with detail map - the same texture cause I haven't bothered to create one so you get dirty spots and a bit of saturation from it:

Since this is looking right in ShowToolPro, the question is why it doesn't show up in TGE (1.4 and up)? I am willing to provide assistance to whomever is good at this and maybe we can fix this and release it to the community.
Also, the guy who can fix this in a quick manner will get a free bundle (2 packs: Bridge Pack and TGE Mountain - or environment pack as I call it for the moment);
Post here your ideas or write me an email if you're interested. Thanks!
I recon it is not so important for many people but sometimes it really makes the difference; In TGE a small / medium object with a proper diffuse map could look great; in TGEA the fancy normal mapping and specular make indeed wonders. What if you run into a problem when you really could use a good ol' trick?
I was making these huge mountain bits and since the textures are relatively perfect for the job one may think it was enough. Well, it isn't : ) TGE recommends a maximum resolution of 512x512. On current hardware, 1024x1024 can be used here an there with no problem at all. I can't say about TGEA cause I don't have it / never looked into the issue.
The following example has a good 1024x1024 texture estate (with a bit of repeating as well) and should provide enough detail and it does, as looking at it from a distance ; On a close up however, we got ourselves a huge chunk of the screen covered with this dull blurred texture. And we really need some detail there since the player is about 2 m high (and that's about half the square zoomed region).
no detailmap whatsoever:

with detail map - the same texture cause I haven't bothered to create one so you get dirty spots and a bit of saturation from it:

Since this is looking right in ShowToolPro, the question is why it doesn't show up in TGE (1.4 and up)? I am willing to provide assistance to whomever is good at this and maybe we can fix this and release it to the community.
Also, the guy who can fix this in a quick manner will get a free bundle (2 packs: Bridge Pack and TGE Mountain - or environment pack as I call it for the moment);
Post here your ideas or write me an email if you're interested. Thanks!
Recent Blog Posts
| List: | 12/10/08 - Textures Pack Down 12/09/08 - Materials Bazaar ~ Metals Library release 12/07/08 - Materials Bazaar (II) update 12/03/08 - Materials Bazaar (I) 12/03/08 - TGEA Environment Guide 11/04/08 - Kork 2.0, halted work 09/24/08 - Constructor Pipeline (I) 09/23/08 - Interior Guide Pack Free Download |
|---|
Submit your own resources!| Nathan Kent (Jun 22, 2008 at 00:49 GMT) |
| Morrock (Jun 22, 2008 at 00:52 GMT) |
Just did a quick search for a few things in the source, maybe some of these could give you a lead?
In dgl/gTexManager.cc
U32 sgTextureDetailLevel = 0;
In sceneGraph/detailManager.cc
Line 125-158 are commented out, these seem to have quite a bit to do with bumping.
| Apparatus (Jun 22, 2008 at 01:06 GMT) Resource Rating: 5 |
@Morrock - I am positive bump mapping was left out long ago, people have tried it before; I will send you a test model right away, with and without detail info. I will also install a compiler myself and check it out (so we only exchange info not builds); thanks a lot.
Edited on Jun 22, 2008 01:06 GMT
| Koushik (Jun 22, 2008 at 02:16 GMT) |
@Apparatus: I think the problem might be in the way the texture units are set-up, don't know for sure though. I will take a look at it when I get back to my comp.
And yeah, bump-mapping was removed from the engine a long time ago, but there are still hooks in the code.
If you want normal-mapping with TGE, you might want to first get the modernization kit, and then my fix for DTS shaders Here
Edited on Jun 22, 2008 02:21 GMT
| Craig Fortune (Jun 22, 2008 at 02:57 GMT) |
Morrock: Have another look at the code in detailManager.cc you referred to and you'll see that its to do with bumping between detail levels in a more figurative sense.
| Apparatus (Jun 22, 2008 at 03:46 GMT) Resource Rating: 5 |
mMaxDetailMapDL = -1;
to
mMaxDetailMapDL = 1;
I have absolutely no idea what I actually did, if it's a hack or simply the solution to my problem. It works though, with a few notes:
1. Greyscale textures must comply with TLK instructions or you will get weird lighting on the detail mapped object;
2. Detail texture must be the same size - i'll test more on this later
No detail map:

With detail map:

At this point I need to work on the textures a bit more but it's there.
Edited on Jun 22, 2008 03:47 GMT
| Joseph Greenawalt (Jun 22, 2008 at 04:20 GMT) |
Detail maps exported from Blender work fine in TGE 1.52 without any code changes.

(screenshot from stock TGE 1.52)
Here's a dts file that uses detail maps and works in (stock) TGE: jsgreenawalt.com/Downloads/Blender/TestModels/Material_test2.zip
TGEA still does not support detail maps last time I checked. Does your TGE code change fix the clamp/wrap issues that appear when exporting a scaled detail map?
| Apparatus (Jun 22, 2008 at 04:36 GMT) Resource Rating: 5 |
| Joseph Greenawalt (Jun 22, 2008 at 04:53 GMT) |
When you say that you can tile the detail, do you mean that you can tile it at a different interval than the diffuse texture? If so, I'd love to get my hands on a model that shows it working (just a simple cube would do :-). If you want to post or email me such a model I'd be glad to help out with trying to find the difference between the max and blender detail maps, which should hopefully lead to an exporter-side fix for the problem that you're having :-)
| Joseph Greenawalt (Jun 22, 2008 at 06:01 GMT) |
| Apparatus (Jun 22, 2008 at 06:33 GMT) Resource Rating: 5 |
| Joseph Greenawalt (Jun 22, 2008 at 06:43 GMT) |
The shortened version:
Yeah, I do think that an exporter fix is possible, and probably preferable to hardcoding nMaxDetailMapDL. But it really depends on the exact nature of the problem. I'll take a look at the model you sent and see if I can figure out what's going on.
| Joseph Greenawalt (Jun 22, 2008 at 08:33 GMT) |
edit - also it looks like the differences between the two detail map rendering procedures may account for the clamp/wrap problem in the code path that Blender exported models are using.
Edited on Jun 22, 2008 08:42 GMT
| Apparatus (Jun 22, 2008 at 09:39 GMT) Resource Rating: 5 |
| Leslie Young (Jun 22, 2008 at 11:59 GMT) |
In tsShapeInstance.cc I changed
mMaxDetailMapDL = dl; to mMaxDetailMapDL = dl+1; (which causes 0 to be 1, and the rest +1 from there if you got detail map on other detail levels)
It must be ignoring or following a different codepath as Joseph said when mMaxDetailMapDL is 0.
| Joseph Greenawalt (Jun 22, 2008 at 12:01 GMT) |
www.garagegames.com/mg/forums/result.thread.php?qt=76451
| Morrock (Jun 22, 2008 at 16:48 GMT) |
I added the following code to the S32 TSShapeInstance::selectCurrentDetailEx(F32 errorTOL) function, right at the beginning after the description comment.
if (mShape->mSmallestVisibleDL == 0)
{
// get here if we are drawing at DL==0
mCurrentDetailLevel = 0;
mCurrentIntraDetailLevel = 1.0f;
return mCurrentDetailLevel;
}
It has the detail texture and doesn't "pop" when loading into a different LOD.
edit: I left out the return value from this, fixed it. Sorry for the mix-up Joseph :/
Edited on Jun 22, 2008 23:55 GMT
| Morrock (Jun 22, 2008 at 16:54 GMT) |




edit: Alright, never posted images in comments here before... I tired BBC, HTML, I give up, how do I do it.
Never mind. Thanks silentMike.
Edited on Jun 22, 2008 17:42 GMT
| Michael (silentMike) Hall (Jun 22, 2008 at 17:20 GMT) |
Bridges, mountains, rainbows, waterfalls, rivers, and trees oh my! What else have you got hidden up your sleaves to show off in your environment pack?
@Morrock: BBC uses [ img ] for images, on here you gotta use the word image.
edit: hung-over Sunday morning spelling ;)
edit: removed image - no problem Morrock!
Edited on Jun 22, 2008 18:42 GMT
| Apparatus (Jun 22, 2008 at 19:23 GMT) Resource Rating: 5 |
Oh, and thanks everyone! I am collecting email addresses and sending over the link for download right now.
Edited on Jun 22, 2008 19:24 GMT
| Joseph Greenawalt (Jun 22, 2008 at 23:11 GMT) |
Hardcoding mCurrentIntraDetailLevel to 1.0 for the last DL does cause the detail maps to be drawn, but they don't fade out as the distance from the camera increases. That's one of the solutions that I considered. Perhaps the lack of fading isn't important, and hardcoding mCurrentIntraDetailLevel to 1.0 for the last DL does prevent the "popping" issue that I mentioned in the thread. I'm not sure why you're not seeing any difference with my suggested change though... I am seeing a difference here using the model that Apparatus sent me. I took a version with detail map and without and set them right against each other and the difference was pretty obvious (here at least :-)
| Morrock (Jun 22, 2008 at 23:58 GMT) |
| Joseph Greenawalt (Jun 23, 2008 at 00:04 GMT) |
You must be a member and be logged in to either append comments or rate this resource.



4.3 out of 5


