Quake3World.com Forums
     Level Editing & Modeling
        Two questions about shaders


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: Two questions about shaders

Trainee
Trainee

Joined: 22 Jul 2011
Posts: 45
PostPosted: 07-24-2011 03:40 AM           Profile Send private message  E-mail  Edit post Reply with quote


I'm trying to change the color of a white fade using a shader but I'm having problems. This is the shader script:
Code:
textures/vr2/blue_cube
{
   qer_editorimage textures/vr2/cube.tga
   surfaceparm trans
   cull disable
   polygonoffset
   q3map_nolightmap
   qer_trans 1
   {
      map textures/vr2/cube.tga
      rgbGen const ( 0 1 1 )
      blendfunc blend
   }
}

cube.tga has the white fade and I tried to change it to cyan (0 1 1), what I'm doing wrong?

I have also a question about gtkradiant. Would be useful to see the two shades in the textures window but when I don't set the editorimage key it puts a "shader image missing" and when I set it with the shader as a texture it puts the same. If I'm not wrong netradiant puts the shader image even without the need of the key, can't gtkradiant (1.5) do the same?




Attachments:
white.jpg
white.jpg [ 46.64 KB | Viewed 23 times ]
cyan.jpg
cyan.jpg [ 40.04 KB | Viewed 25 times ]
Top
                 

I'm the dude!
I'm the dude!

Joined: 04 Feb 2002
Posts: 10435
PostPosted: 07-24-2011 04:08 PM           Profile Send private message  E-mail  Edit post Reply with quote


You won't need polygonOffset for your cube.

rgbGen const just assigns the surface with a constant vertex colour value, it does not alternate between colours.

To do what I think you want (have it fade between white and cyan in a loop), you'll need to do a few things:

  • 2 shader stages - one for the default white (texture and blendFunc) and a second the exact same except with rgbGen const in the colour of your choice
  • alphaGen wave in both shader stages. This will modify the vertex alpha of each stage.
  • opposite phase values (0 and 0.5) for alphaGen wave. This will make only one stage fully visible at a time.

The basic idea is that you want the white stage to be opaque and then fade to transparent, while the cyan stage starts as transparent and fades to opaque.

See the shader manual in my signature for details.



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

Trainee
Trainee

Joined: 22 Jul 2011
Posts: 45
PostPosted: 07-25-2011 01:53 AM           Profile Send private message  E-mail  Edit post Reply with quote


The idea it's change the color of the white fade to another color, without alternate. But the result is a cube with much more brightness that the white one has.

About polygonoffset, if I don't put it I have Z-fighting on the faces which are touching another face. I've tried sort banner too but for some reason it doesn't work, the part of the cube which is in front of the sky becomes invisible.




Top
                 
Quake3World.com | Forum Index | Level Editing & Modeling


Post new topic Reply to topic


cron
Quake3World.com
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group