Editable Terrain Manager [v2.2 released]

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
Post Reply
Kerion
Goblin
Posts: 235
Joined: Wed Feb 05, 2003 5:49 am
Contact:

Post by Kerion »

So if I am understanding you correctly, I would need to add a pass to the terrain material (easy enough), which has a fragment shader which calculates the interpolation. The result of that fragment shader (the final interpolated texture), would then be used for the lightmap pass of the terrain? That sound about right?
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Post by CABAListic »

Yes, but the pass with the fragment shader already *is* the lightmap pass of the terrain, just to prevent any misunderstandings :)

So, better say that you would replace the lightmap pass of the demo material with your customised interpolating pass.
Kerion
Goblin
Posts: 235
Joined: Wed Feb 05, 2003 5:49 am
Contact:

Post by Kerion »

Sounds great. When I get it working, I will post a video of ETM + Caelum doing time correct lightmaps :D
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Post by CABAListic »

Ok, new release is out, get it at the usual place: ETM v2.2

Changes in this version:
  • Fixed bounding boxes of terrain tiles (were not updated correctly when editing terrain)
  • Fixed a crash when setting maxLOD to 1 and enabling lodMorph
  • Feature: Added optional vertex normals (needed for dynamic lighting)
  • Feature: Added base texture creation to SplattingManager (see demo)
  • License: Switched to the less restrictive GPLv2 with runtime exception. You can now link statically even in closed source apps, if you like.
Base textures have varied uses :) You can even use them with the minimap creation function for more detailed minimaps, basically a sort of top-down view on your map:
Image

Have fun.
Kerion
Goblin
Posts: 235
Joined: Wed Feb 05, 2003 5:49 am
Contact:

Post by Kerion »

Hey, one more quick question for you. In PSLighting.cg is defined as:

void main
(
float2 iTexCoord0 : TEXCOORD0,
out float4 oColor : COLOR,
uniform sampler2D lightMap
)
{
oColor = tex2D(lightMap, iTexCoord0);
}

Which is simple enough, but where is the lightMap parameter coming from? Is that being assigned internally by ETM? If so, in my case, I guess I will leave that as is but change the definition to:

void main
(
float2 iTexCoord0 : TEXCOORD0,
out float4 oColor : COLOR,
uniform sampler2D lightMap,
uniform sampler2D lightMapInter0,
uniform sampler2D lightMapInter1
)

In my final engine, I would likely modify ETM so that it's not passing a lightmap texture I don't need, but for the quick and dirty hack to get this to work, I am guessing that lightMap is passed in internally and that I will be setting the lightMapInter0 and lightMapInter1 properties (I know I will be doing that, I am just curious about the lightMap argument).
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Post by CABAListic »

Nope, this is not coming from ETM, it's coming from the material. It's simply the texture unit from the material pass specifying the lightmap. So for your case you would indeed replace it with two parameters, just as in the material pass you need to define two texture units.
Kerion
Goblin
Posts: 235
Joined: Wed Feb 05, 2003 5:49 am
Contact:

Post by Kerion »

Ah, so OGRE does that automatically. For all the years I've been playing with OGRE, this is the first time I am playing with fragment shaders. So OGRE automatically associates each texture unit defined with the n'th sampler2D used in the parameters?

So really all I need to do from frame to frame is make sure the texture_units are updated with the correct lightmap and pass in the interpolation factor. Hmm, this isn't going to be nearly as difficult as I thought. Thanks again Cabal!
User avatar
Brocan
Orc
Posts: 441
Joined: Tue Aug 01, 2006 1:43 am
Location: Spain!!
x 8

Post by Brocan »

CABAListic wrote:Ok, new release is out, get it at the usual place: ETM v2.2
Thanks for revision and new features, impressive as always :D
Kerion
Goblin
Posts: 235
Joined: Wed Feb 05, 2003 5:49 am
Contact:

Post by Kerion »

Well I've got the lightmap interpolation working, and so far it looks great. I still need to do a couple of things, like adjust the ambient light used to make the light map based on time of day (right now I am using a flat 0.5, 0.5, 0.5 ambient).

Does anyone know a realistic formula to approximate the curve of light as the sun rises and falls? I doubt it's a perfectly linear fall off, though I guess a linear one would approximate it well enough for most situations.
Kerion
Goblin
Posts: 235
Joined: Wed Feb 05, 2003 5:49 am
Contact:

Post by Kerion »

It all looks good, accept that the Caelum skydome is wayyyy above the terrain, in such a way that a giant band of "nothing" (fog basically) is left between the bottom of the skydome and the terrain horizon. Have to play with that a little a bit.
Vectrex
Ogre Magi
Posts: 1266
Joined: Tue Aug 12, 2003 1:53 am
Location: Melbourne, Australia
x 1
Contact:

Post by Vectrex »

Kerion wrote:Well I've got the lightmap interpolation working, and so far it looks great. I still need to do a couple of things, like adjust the ambient light used to make the light map based on time of day (right now I am using a flat 0.5, 0.5, 0.5 ambient).

Does anyone know a realistic formula to approximate the curve of light as the sun rises and falls? I doubt it's a perfectly linear fall off, though I guess a linear one would approximate it well enough for most situations.
Doesn't caelum also set the ambient light over time?
Kerion
Goblin
Posts: 235
Joined: Wed Feb 05, 2003 5:49 am
Contact:

Post by Kerion »

Vectrex wrote:
Kerion wrote:Well I've got the lightmap interpolation working, and so far it looks great. I still need to do a couple of things, like adjust the ambient light used to make the light map based on time of day (right now I am using a flat 0.5, 0.5, 0.5 ambient).

Does anyone know a realistic formula to approximate the curve of light as the sun rises and falls? I doubt it's a perfectly linear fall off, though I guess a linear one would approximate it well enough for most situations.
Doesn't caelum also set the ambient light over time?
Not that I could tell. At any rate, I got a very realistic curve going for the lightmap generation and it looks good at this point. At high speed the interpolation is somewhat obvious (like in 1:1024 time scale), but in a more game realistic time scale (say 1:24 or 1:12), it will be hardly noticeable but should give a nice realistic feel to the shading of the terrain.
OgreUser
Gnoblar
Posts: 13
Joined: Mon Jul 16, 2007 7:51 pm

Post by OgreUser »

Great job :D
A lil screenie for teh bump :

Image
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Post by KungFooMasta »

That terrain looks good! :shock:
Kerion
Goblin
Posts: 235
Joined: Wed Feb 05, 2003 5:49 am
Contact:

Post by Kerion »

Hey OgreUser, I don't suppose I could get the heightmap and splat data for that terrain could I? I would love to use that as a test terrain for this lightmap interpolation. Your terrain looks great, so I figure it will make a great video.
OgreUser
Gnoblar
Posts: 13
Joined: Mon Jul 16, 2007 7:51 pm

Post by OgreUser »

Hey Kerion :)
Indeed I hadn't saved, but I tried to make another one, as similar as possible, and another one for bonus :wink: .

I zipped all I could find in the ET media folder needed for the terrain :

1. http://fileho.com/download/3e7ccb263412 ... 1.zip.html


2.
Image
http://fileho.com/download/d86e70280878 ... 2.zip.html
Kerion
Goblin
Posts: 235
Joined: Wed Feb 05, 2003 5:49 am
Contact:

Post by Kerion »

Spectacular, thanks. I will post some videos of the lightmap stuff soon I hope. Still working on an issue with Caelum.
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Post by CABAListic »

Hehe, nice work, especially considering that the sample is just a demonstration and not a real editor in any way :D
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Post by KungFooMasta »

I'm curious, has anybody developed a ETMaterial class, that can manage switching, adding, and removing splatting textures? (this would have to interface the splats per pass also, and create/destroy passes on the fly) I wonder if a Brush Class would be needed, and if it would, would it be part of the ETMaterial class or not, since it could be used for deforming. (interested in the design and if anybody has done it. :) )

When I get back to tinkering with ETM, hopefully at the end of this year, I will start working on one, if nobody else has. I remember an ETMaterial class in the first release of ETM, the would probably be a good place to start.
User avatar
neocryptek
Gnome
Posts: 335
Joined: Sat Mar 01, 2003 11:21 pm
Location: Idaho, USA
Contact:

Post by neocryptek »

Could someone upload these somewhere else where you don't need to use Internet Explorer and download some adware (or worse?) plugin just to download the files?

And thanks OgreUser, they look great!
OgreUser
Gnoblar
Posts: 13
Joined: Mon Jul 16, 2007 7:51 pm

Post by OgreUser »

My bad, rapidshare should be fine :

http://rapidshare.com/files/54176385/ET ... k.zip.html
Kerion
Goblin
Posts: 235
Joined: Wed Feb 05, 2003 5:49 am
Contact:

Post by Kerion »

Hmmm, perhaps I am missing something, but how do I get ET to use the ETbase.png as it's base texture?
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Post by CABAListic »

By creating a corresponding terrain material :)
This might look something like this:

Code: Select all

material Terrain
{
  // specify the distance at which to switch to the base texture
  lod_distances 300
  
  // insert here your usual splatting based technique
  // technique { ... }
  // ...
  
  // simple base texture pass
  technique
  {
    lod_index 1
    
    pass
    {
      // base texture
      texture_unit
      {
        texture base.png
      }
      
      // lightmap
      texture_unit
      {
        texture lightmap.png
        colour_op modulate
      }
    }
  }
}
Basically you add another technique for lower LOD rendering which just uses your base texture modulated by the lightmap. But I've not tried this, it's just off the top of my head, so you probably need to tweak it a bit :)

Also note that you should use a fairly large (2048x2048) base texture, otherwise this just won't look good.
User avatar
Dibalo
Halfling
Posts: 63
Joined: Mon Oct 16, 2006 4:10 pm
Location: Finland

Post by Dibalo »

This might be a stupid question: How large maps ETM can handle with proper fps? Let´s say we have up to six splatting textures and lightmap.
Dattebayo!
jjp
Silver Sponsor
Silver Sponsor
Posts: 597
Joined: Sun Jan 07, 2007 11:55 pm
Location: Cologne, Germany
Contact:

Post by jjp »

Dibalo wrote:This might be a stupid question: How large maps ETM can handle with proper fps? Let´s say we have up to six splatting textures and lightmap.
Depends entirely on the system you want to use, on the size of the textures and on what else is in your scene. You'll have to test it yourself, there is no other way of knowing.
Enough is never enough.
Post Reply