Jump to content

Home

Some shader questions


FarbrorGnur

Recommended Posts

I'm freaking out because I had a shader but now I can't find the correct commands and lines again no matter what I do.

 

1) I have a picture on the wall, and it gets blended by the reflection from a mirror (portal). This functions properly, and has functioned even more properly. The problem is that it looks bad, and it did look good before.

What I have is a picture (catpicture.jpg) and the same picture with a grey alpha channel for halfish transparency (catpicture_alpha.tga).

 

I don't know what to do with the shader anymore because I've tried so many things. I have two versions I'm testing at the same time:

 

textures/SP/dogpicture
{
qer_editorimage	textures/SP/catpicture.jpg
surfaceparm	nonsolid
surfaceparm	playerclip
portal
q3map_nolightmap
   {
       map textures/SP/catpicture_alpha.tga
       blendFunc GL_ONE GL_ONE_MINUS_SRC_ALPHA
       depthWrite
       alphaGen portal 2048
   }
}

textures/SP/catpicture
{
qer_editorimage	textures/SP/catpicture
portal
q3map_nolightmap
   {
       map textures/SP/catpicture
       blendFunc GL_ONE GL_ONE_MINUS_SRC_ALPHA
       depthWrite
       alphaGen portal 2048
   }
   {
map textures/SP/catpicture_alpha.tga
blendfunc blend
depthWrite
   }
}

 

Since I'm trying to make it work on two different brushes, I've called one of them dogshader so that it won't interfere. I can make different results with them, but I'm struggling to find back to the right one.

 

What I need: I want the picture on the wall to be (preferrably) affected by the map lighting, but I've ran into problems with portal and lightmap at same time, so it's acceptable with a nolightmap. I want the picture to be most visible, and let the alpha channel set the transparency for the mirror. I managed to do this somehow, but when trying to make a better way to solve it (by using only one .tga file and not a .jpg file), I screwed up. The shaders above have the same results, which gives me the hope that it can be achieved without blending it with a special made .tga, because I intend to have more than one picture, and it would be best if I could let each picture be .tga format, have an alpha channel, and let it blend the texture with its own alpha channel, so that the picture is the most visible, and the mirror is less visible, and doesn't get over exposed in the reflection (like the blendfunc add makes it).

 

 

2) Is there a way to make light emitting shaders keep their original intensity instead of becoming brighter, but rather just radiate light into the room? This is for a floor, and the shader looks like this:

 

textures/SP/woodenfloor1
{
qer_editorimage textures/SP/woodenfloor1
q3map_surfacelight	300
q3map_lightimage textures/SP/lightimage.tga
   {
map $lightmap
       rgbGen identity
   }
   {
       map textures/SP/woodenfloor1
       rgbGen identity
   }
}

 

I tried to use a lightimage because I had the impression it could fix the issue, but the texture stayed the same, so it's the same with and without.

 

 

3) Is this relevant and possible for JK2 or JKA? http://en.wikibooks.org/wiki/GtkRadiant/Skyportals (I know it doesn't exist in our GTKradiant already).

Link to comment
Share on other sites

For the floor, giving the floor a q3map_nolightmap, then removing the lightmap stage, should do what you want.

But i would need to test it to be sure.

 

I am not sure about the cat thing. I'm not clear on what you are trying to get it to do even. Show a reflection on it, as if it were covered in glass?

Link to comment
Share on other sites

To clarify on the picture thing:

 

picturereflection.jpg

 

You can see both the picture, and Kyle's reflection in the picture. It's because there is a portal thing. What I want is to let the cat picture's alpha channel (which is grey) moderate the portal's transparency, like making the portal less reflecting (if portal is the right word in this context). I don't remember how I did it, but somehow I used a blendmode I can't remember (and can't rediscover) and blended the two stages with each other, where one of the stages was a copy of the catpicture, just in TGA format (with grey alpha channel), while the original catpicture was still jpg. So jpg blended with a tga, they looked the same, but one of them had an alpha channel. It looked good, it did what I wanted, but then I got a better idea, because I didn't want to duplicate all the pictures I would have in the entire campaign, just to get that effect, because it would really add a lot of unnecessary space. So my idea was to instead of blending jpg with tga, when they both looked the same visually, was to only use the tga file (which had an alpha channel), and blend the visual image in it, with its own alpha channel, to achieve the same effect, and to only use one picture instead of two. After this idea, there's a blank void in my memory timeline, and I can't remember how I messed it up.

 

I hope that made sense :D

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...