Problems with foliage on dotproduct terrain


(DickDastardly) #1

Hi all,
I’ve been playing around with dotproduct terrain for the ET conversion of UrT recently, but I’m having problems getting foliage to appear on the correct parts. The shader below seems to work fine, but of the three foliage models, only dd_grassfoliage33d.ase (i.e. the one using inverse alpha) appears, and it does so on the rock_1.tga texture, whereas i want it to appear on grass_1.tga. Can anyone tell me what I need to change in the shader to achieve this?

(BTW I realise the odds part of the foliage lines are very high, I just tried higher and higher values in the hope of getting them to appear. Also, the foliage models all work ok as foliage on a normal texture so dodgy models can’t be the reason for their non-appearance).
Cheers,
DD

textures/ut_terrain/grassrockdot04
{
q3map_lightImage textures/ut_terrain/kt_stone3mod.tga
q3map_forceMeta
q3map_nonplanar
q3map_shadeAngle 179
q3map_lightmapAxis z
//q3map_foliage <model> <scale> <density> <odds> <use inverse alpha>
q3map_foliage models/mapobjects/aamjs_mod/dd_grassfoliage23d.ase 1.5 4 0.25 0
q3map_foliage models/mapobjects/aamjs_mod/dd_grassfoliage33d.ase 1.5 4 0.1 1
q3map_foliage models/mapobjects/aamjs_mod/dd_grassfoliage13d.ase 1.5 4 0.9 0
q3map_lightmapSampleOffset 8
q3map_tcGen ivector ( 128 0 0 ) ( 0 128 0 )
q3map_tcMod rotate 33
q3map_alphaMod dotproduct2 ( 0 0 0.8 )
q3map_clipModel
q3map_lightmapSampleSize 8
q3map_globalTexture
{
map textures/ut_terrain/kt_stone3mod.tga
rgbGen identity
}
{
map textures/ut_terrain/rock_1.tga
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
alphaFunc GE128
rgbGen identity
alphaGen oneMinusVertex
}
{
map textures/ut_terrain/grass_1.tga
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
alphaFunc GE128
rgbGen identity
alphaGen vertex
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
}
}


(ydnar) #2

Flip the inverse alpha bit at the end. The grass appears where there’s positive alpha in the shader, so your foliage should not have the inverse alpha bit set.

y


(DickDastardly) #3

Thanks for the quick reply m8. Not sure what u meant by flipping the inverse alpha bit though - if you meant the last number in the q3map_foliage lines, I already tried that: The shader above has two q3map_foliage lines with a value of 0 at the end and another one with a value of 1. Only the line ending in 1 causes models to appear anywhere on the terrain.
DD


(ydnar) #4

Got a screenshot?


(DickDastardly) #5

You can see one type of the foliage models (the one using inverse alpha) being drawn on the rocks in this shot:

The models in the shader above which don’t have inverse alpha don’t appear at all (although they do work in other non dotproduct shaders I’ve written). BTW I realise the density of models in that shot is insanely high, I was just trying high values in the hopes of getting the other two to appear).
Cheers,
DD

A few other test terrain shots (without foliage):

http://www.mikesteven.pwp.blueyonder.co.uk/et/sc_testterrain01.jpg
http://www.mikesteven.pwp.blueyonder.co.uk/et/sc_testterrain02.jpg
http://www.mikesteven.pwp.blueyonder.co.uk/et/sc_testterrain03.jpg
http://www.mikesteven.pwp.blueyonder.co.uk/et/sc_testterrain04.jpg
http://www.mikesteven.pwp.blueyonder.co.uk/et/sc_testterrain05.jpg


(ydnar) #6

Wow, nice. Your terrain really blends well with the skybox. Is that Machu Picchu?

Set the last number of the foliage lines to 0, so it uses normal (not inverted) alpha. Then increase the last value of the dotProduct2 to 1.0 instead of 0.8 and recompile.

y


(DickDastardly) #7

That did the trick m8, thanks for your help. :slight_smile:

BTW well spotted, that is Machu Picchu in the other shots, it’s part of a skybox I’m making for ut_junglefever which is still under construction. I’m planning on having a path along a cliff ledge with a ropebridge over a chasm from where you’ll be able to look towards the view of Machu Picchu.
Cheers,
DD


(ratty redemption) #8

very nice terrain and sky box :slight_smile:


(Davros) #9

yes good luck with the jungle map