Game Development Community

Atlas2 detailtexture settings in mission file / editor

by Marc 'Dreamora' Schaerer · 03/04/2007 (7:42 am) · 3 comments

Download Code File

This resource adds the support for detail texturing settings on a per-terrain base instead of the hardcoded default behavior. The fields are editable through the mission file as well as through the regular editor.

As an example:
new AtlasInstance2(NewTerrain) {
      canSaveDynamicFields = "1";
      position = "-4032.29 -3264.87 84";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      detailTex = "~/data/terrains/details/detail1";
      atlasFile = "~/data/terrains/test2.atlas";
      lightMapSize = "8192";
      detailStartRange = "50.0";     // Default is 30
      detailEndRange = "150.0";     // Default is 40
      detailRepeat = "32.0";            // Default is 128.0

   };

StartRange and EndRange define the range within which the detail texture fades in. / out.
StartRange is where it starts to fade out while EndRange is the range at which it is completely fade out.
Repeat defines how many times the detail texture is repeated over your terrain. (in both directions)


Installation

Just replace engine/atlas/runtime/atlasInstance2 .h / .cpp with the files in the zip and recompile.
Thats all.
It should not interfer with anything as nothing was modified.
It only sets some values on the batcher before rendering the terrain. (those are used by the batcher to setup the shader)

#1
03/27/2007 (6:59 am)
Great resource. I was curious though about an artifact that I see at runtime. If you make the detail texture span the entire terrain (not repeat) and the texture is larger than 2048x2048 you get some very funky results. Any image 2048 or smaller works fine. Has anyone else ran into this?
#2
03/27/2007 (7:01 am)
There is an overlay texture thread on the TGEA boards which seems to indicate that overlays larger than 2048x2048 are not supported and will cause problems.
As I do not need it, I have not checked the shader code to see if this is the cause for this restriction or a code set shader constant used by the shader.
#3
03/28/2007 (6:37 am)
Yeah, I started that thread and haven't been able to get a response from Ben or Brian.