Doom3world

The world is yours! Doom 3 - Quake 4 - ET:QW - Prey - Rage
It is currently Sun May 19, 2013 5:55 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: triggering texture animation
PostPosted: Thu Aug 21, 2008 8:55 am 
Offline
found a secret
User avatar

Joined: Tue May 24, 2005 12:16 am
Posts: 520
Is it possible? What i want to do is to trigger specifical shader of animated texture (when player hits the trigger, textures beginning to scroll for instance). Is Doom capapble of such things? If so, how should script look? Let's say i got texture, with two material entries, one normal static A, and one animated B. How shopuld script look and what i should do to make trigger them to animate?

_________________
N I И


Top
 Profile  
 
 Post subject: Re: triggering texture animation
PostPosted: Sun Aug 24, 2008 12:02 pm 
Offline
Last man standing
User avatar

Joined: Fri Apr 22, 2005 11:55 pm
Posts: 1180
You probably have to create a conditional stage in your material that is executed only when you set a certain shaderparm on your entity.

Code:
yourmaterial
{
    //material stuff here...

   { //do this only if shaderparm7 is 1
     if ( parm7 == 1 )
     scroll time * .8 , time * .3
   }
}

Or something close to that, don't know exactly :D

_________________
Fragging Free - a frantic Doom3:ROE single-player modification.


Top
 Profile  
 
 Post subject: Re: triggering texture animation
PostPosted: Sun Aug 24, 2008 6:41 pm 
Offline
found a secret
User avatar

Joined: Tue May 24, 2005 12:16 am
Posts: 520
how does it works exactly? i tried to find something in mars city level (because chinese guy's face slowly turning into zombie after opening the gate is clearly this effect i want to learn), but it's such a mess that i can't find anything. Any help? OR at least hint, where i should look for this kind of things to check everything myself? Please, i would be very grateful

_________________
N I И


Top
 Profile  
 
 Post subject: Re: triggering texture animation
PostPosted: Tue Aug 26, 2008 8:29 am 
Offline
Last man standing
User avatar

Joined: Fri Apr 22, 2005 11:55 pm
Posts: 1180
Your material should look like
Code:
textures/atest
{
   qer_editorimage   textures/base_wall/boxpanel.tga

        {
      if ( parm7 == 0 )      
      blend       bumpmap
      textures/base_wall/boxpanel_d.tga
   }
   {
      if ( parm7 == 0 )
      blend            diffusemap      
      map      textures/base_wall/boxpanel_s.tga
   }
   {
      if ( parm7 == 0 )         
      blend      specularmap
      map      textures/base_wall/boxpanel_s.tga
   }


   {
      if ( parm7 == 1 )      
      blend       bumpmap
      textures/base_wall/boxpanel_d.tga
      scroll time * -.7 , time * .8
   }
   {
      if (  parm7 == 1 )
      blend   diffusemap   
      map      textures/base_wall/boxpanel_s.tga
      scroll time * -.7 , time * .8
   }
   {
      if ( parm7 == 1 )         
      blend      specularmap
      map      textures/base_wall/boxpanel_s.tga
      scroll time * -.7 , time * .8
   }
   
}

when you set via script shaderparm7 to 1, the texture begins to scroll.
Code:
$entity_with_this_material.setShaderParm(7, 1 );


Absolutely never tested, but it should be (almost) ok :D

_________________
Fragging Free - a frantic Doom3:ROE single-player modification.


Top
 Profile  
 
 Post subject: Re: triggering texture animation
PostPosted: Tue Aug 26, 2008 11:42 am 
Offline
Invisibility
User avatar

Joined: Fri Aug 13, 2004 4:39 pm
Posts: 3654
Location: Right there! Look!
That works, I use it all the time in Hexen:Edge of Chaos for the weaponry. In fact we also used this technique to add a seperate 'rain' stage. Which makes things look wet when it's raining in a map. It's a very versatile feature.

_________________
Check out GRIMM Quest for the Gatherer's Key!
Grimm's Youtube Channel

Follow Grimm Quest on Twitter!


Top
 Profile E-mail  
 
 Post subject: Re: triggering texture animation
PostPosted: Tue Aug 26, 2008 1:34 pm 
Offline
found a secret
User avatar

Joined: Tue May 24, 2005 12:16 am
Posts: 520
thank you guys, testing right now, so far nothing, but i play around it a little more, thanks again!

_________________
N I И


Top
 Profile  
 
 Post subject: Re: triggering texture animation
PostPosted: Fri Aug 29, 2008 9:56 am 
Offline
Last man standing
User avatar

Joined: Fri Apr 22, 2005 11:55 pm
Posts: 1180
"map" keyword inthe bumpmap stage was missing in my previous post :roll:

_________________
Fragging Free - a frantic Doom3:ROE single-player modification.


Top
 Profile  
 
 Post subject: Re: triggering texture animation
PostPosted: Wed Jan 27, 2010 9:40 am 
Offline
found a secret
User avatar

Joined: Tue May 24, 2005 12:16 am
Posts: 520
Using shaders parm work like a charm :D

I have another question, even two:

1) Is it possible to make triple changer material? In example - texture A -> B, then B-> C with one material?

2) How about blending? A->B with A fading out and B fading in?

If it is, how to do that?

_________________
N I И


Top
 Profile  
 
 Post subject: Re: triggering texture animation
PostPosted: Wed Jan 27, 2010 9:55 am 
Offline
Invisibility
User avatar

Joined: Fri Aug 13, 2004 4:39 pm
Posts: 3654
Location: Right there! Look!
mth wrote:
Using shaders parm work like a charm :D

I have another question, even two:

1) Is it possible to make triple changer material? In example - texture A -> B, then B-> C with one material?

2) How about blending? A->B with A fading out and B fading in?

If it is, how to do that?


1) Yes, an example:
Code:
{
    ( if Parm8 == 1 )
    blend add
    <blah>
}
{
    ( if Parm8 == 2 )
    blend add
    <blah>
}
{
    ( if Parm8 == 3 )
    blend add
    <blah>
}


Etc..etc.. But it's better to just use a skin if you want to do this, with the setSkin() function.

Blending/fading is a bit more tricky. You would need to use a Parm for that, something like:
Code:
{
    blend add
    map <blah>
    RGB Parm8
}
{
    blend add
    map <blah>
    RGB Parm9
}


With script/SDK you would loop through parms 8 and 9, e.g. for Parm8 from 0-1 and for Parm9 from 1-0.

_________________
Check out GRIMM Quest for the Gatherer's Key!
Grimm's Youtube Channel

Follow Grimm Quest on Twitter!


Top
 Profile E-mail  
 
 Post subject: Re: triggering texture animation
PostPosted: Wed Jan 27, 2010 10:38 am 
Offline
found a secret
User avatar

Joined: Tue May 24, 2005 12:16 am
Posts: 520
Oh shit, so parms can have values other than 0 and 1? Awesome, with that knowledge both examples are piece of cake, thanks!

_________________
N I И


Top
 Profile  
 
 Post subject: Re: triggering texture animation
PostPosted: Wed Jan 27, 2010 10:48 am 
Offline
Invisibility
User avatar

Joined: Fri Aug 13, 2004 4:39 pm
Posts: 3654
Location: Right there! Look!
Yup, afaik Parms are just floats.

_________________
Check out GRIMM Quest for the Gatherer's Key!
Grimm's Youtube Channel

Follow Grimm Quest on Twitter!


Top
 Profile E-mail  
 
 Post subject: Re: triggering texture animation
PostPosted: Sat Aug 28, 2010 7:05 pm 
Offline
found a secret
User avatar

Joined: Tue May 24, 2005 12:16 am
Posts: 520
how about blending between two different normlamaps, is it possible somehow?

_________________
N I И


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group