Super Happy Cow@Posted: Thu Aug 02, 2007 1:20 pm :
I've been tasked with creating a bunch of trees for Quake 4, and for the most part, that's easy enough. The actual wood won't be too hard to create, but the leaves are becoming a pain.
Image

What I want to do here, is take what I have in that image, and with this material:
textures/tree/leaves
{
noshadows
twosided
{
blend diffusemap
map textures/tree/leaves_d.tga
alphatest .75
}

}

And implement some lines that would make the leaves 75 percent opaque, and deform with turbulance. Sounds easy enough, but, with alphatest, the "deform turbulant" keyword only affects the alpha layer, for some horrible reason. Parts of the meshes that should be invisible become white, and the green, visible parts of the leaves become invisible as the alpha moves around. Now, with regular alpha, I turbulant works fine and the leaves become opaque, but the leaves can't be lit, which looks pretty terrible, considering that Quake 4 is very heavy on lighting. That's also the same reason I can't use sprites, or a bunch of different planes that criss cross.

Now, does anyone know any keywords that could help me achieve this effect? Or does anyone one have a tried and true method to building trees better, stronger, and...faster?(?)

I really do appreciate any kind of help. <3



The Happy Friar@Posted: Thu Aug 02, 2007 2:21 pm :
sadly, not much you can do. your best bet for moving leaves/branches is to use an animated model.

Also, you'll find you have an issue with lighting the leaves. When using a light source, the leaves will be lit from that direction. Won't look good. Some leaves will be black.

I recommend making the leaves a certain spectrum in the material file & use a special light on that spectrum to light the leaves with an ambient light. You'll notice, in the day time, forests are general a single light level with exceptions where the light gets through the trees.



parsonsbear@Posted: Thu Aug 02, 2007 2:48 pm :
use a solid diffuse channel and keep using the deform turbulent w/ alphatest. or better yet, drop def turbulent and translate it around with a sin table or something along those lines. It'd prevent you from putting the branches in the same texture though.

the spectrum ambient is a great idea, that keyword doesn't get used nearly as much as it should, considering how useful light linking is in renderers w/ limited shading capabilities. It's probably broken in some annoying way...



Super Happy Cow@Posted: Mon Aug 06, 2007 6:16 am :
So, uhhh... how do I use this spectrum keyword? I mean, I read the modwiki page on it, but I never created a light shader. D:



rich_is_bored@Posted: Mon Aug 06, 2007 6:23 am :
They are created the same way material shaders are created. In fact, the only difference between light shaders and material shaders is the naming convention.

For instance, if you preface the name of your shader with "light/" it will show up in the light inspector.



The Happy Friar@Posted: Mon Aug 06, 2007 2:32 pm :
Super Happy Cow wrote:
So, uhhh... how do I use this spectrum keyword? I mean, I read the modwiki page on it, but I never created a light shader. D:


you need a texture with the spectrum keyword & a number:
Code:
textures/thf/war_baby/nature/ivy02
{
   twoSided
   nonsolid
   spectrum 7
   qer_editorimage textures/thf/nature/ivy02.tga
   {
      blend diffusemap
      map    textures/thf/nature/ivy02.tga
      alphatest .5
   }

}


Then you need the light to affect it:
Code:
lights/ambientLight_fast_falloff_1_spectrum_7
{
   ambientLight
   spectrum 7
   lightFalloffImage   makeIntensity( textures/thf/ambient/fast_falloff_1.tga )
   {
      map textures/thf/ambient/fast_falloff_1.tga
      colored
      zeroClamp
   }
}


as long as the #'s are the same the light affects only that texture! :D (i may make maps that rank 10 on the crap-o-meter but i learn a lot from them! :D )