Author Topic: Mirrors and "Cameras"  (Read 8332 times)

Dustin

  • Posts: 111
  • Turrets: +0/-0
    • http://alaric.ath.cx/~dustin/cms/index.php
Mirrors and "Cameras"
« on: July 10, 2006, 07:37:28 am »
I've created a brush with a mirror (mirror1 or mirror2) shader applied to it, and have placed a misc_portal_surface within 64 units of it. Ingame, after compiling the map, i see either a checkerboard (grey and white) with "MIRROR SUBFACE" on it, or a white and dark grey grid. Nothing i've tried works. I even copied the mirror shader info from pulse and modified the name so it was the one used by my map.
Nothing.

Stof

  • Posts: 1343
  • Turrets: +1/-1
Re: Mirrors and "Cameras"
« Reply #1 on: July 10, 2006, 09:53:28 am »
Quote from: "Dustin"
I've created a brush with a mirror (mirror1 or mirror2) shader applied to it, and have placed a misc_portal_surface within 64 units of it. Ingame, after compiling the map, i see either a checkerboard (grey and white) with "MIRROR SUBFACE" on it, or a white and dark grey grid. Nothing i've tried works. I even copied the mirror shader info from pulse and modified the name so it was the one used by my map.
Nothing.

Make sure shaderlist.txt is up to date, is used by the editor and the map compiler tool and contains the .shader file referencing the mirror. And make sure the textures used by the mirror shader are all available.

Note : you should find a working mirror in the common.shader file. The Shader should be named mirror ( and not qer_mirror )
urphy's rules of combat
8 ) Teamwork is essential; it gives the enemy someone else to shoot at.
18 ) Make it too tough for the enemy to get in and you can't get out.

Dustin

  • Posts: 111
  • Turrets: +0/-0
    • http://alaric.ath.cx/~dustin/cms/index.php
Mirrors and "Cameras"
« Reply #2 on: July 10, 2006, 10:22:36 am »
The only mirror shaders in common.shader are mirror1, mirror2, and qer_mirror. None of them work. (Also, for cameras, portal, qer_portal and timportal do not work).
My files are up-to-date. shaderlist.txt references common.shader which contains mirror1|2

I've tried EVERYTHING. All the accepted methods (Bubba's Arena Tutorials, the entity description/info for misc_portal_surface, the radiant manual) have failed for me, and i'm following them EXACTLY. It  Just  Doesn't  Work!!

Stof

  • Posts: 1343
  • Turrets: +1/-1
Mirrors and "Cameras"
« Reply #3 on: July 10, 2006, 12:20:48 pm »
Quote from: "Dustin"
The only mirror shaders in common.shader are mirror1, mirror2, and qer_mirror. None of them work. (Also, for cameras, portal, qer_portal and timportal do not work).
My files are up-to-date. shaderlist.txt references common.shader which contains mirror1|2

I've tried EVERYTHING. All the accepted methods (Bubba's Arena Tutorials, the entity description/info for misc_portal_surface, the radiant manual) have failed for me, and i'm following them EXACTLY. It  Just  Doesn't  Work!!

Try with mirror1, edit common.shader and check that all the textures referenced by the shader exist, are available in a pk3 somewhere. If not, copy the shader in your own custom .shader file and change it to reference textures you know are available.
urphy's rules of combat
8 ) Teamwork is essential; it gives the enemy someone else to shoot at.
18 ) Make it too tough for the enemy to get in and you can't get out.

Dustin

  • Posts: 111
  • Turrets: +0/-0
    • http://alaric.ath.cx/~dustin/cms/index.php
Mirrors and "Cameras"
« Reply #4 on: July 10, 2006, 12:59:46 pm »
The texture is available, common/mirror1.tga. I created it (and i'm using SV_PURE 0 for map testing).

Stof

  • Posts: 1343
  • Turrets: +1/-1
Mirrors and "Cameras"
« Reply #5 on: July 10, 2006, 01:49:46 pm »
Well, the texture show is what the engine will display when it can't find the texture or the shader.

Did you launch your map with devmap ? Are you sure the common.shader file is somewhere the game can load it ? Check in the console after you load the map if there is an error message somewhere.

PS : check all the messages you get during map compile. I had a lot of difficulties getting the mirrors to work because GTKRadiant and the map compiler were badly configured and couldn't find the shader files but no error message were shown. Looking at the complete map compile log showed me that the mirror shader couldn't be found.

PPS : and while I'm at it, when you get the checkerboard texture with mirror writen on it, it means you are using the editor texture as if it was an ingame texture. The editor texture should not be used directly ( qer_mirror.tga I believe ) If you get the grey grid, it means the engine cannot load the corresponding shader or texture.

PPPS : you've made the mirror.tga texture yourself you say ? Did you just copy the qer_mirror.tga file ? If so it won't work. You need a transparent texture for the mirror to work. That texture is the one displayed above the reflection and if it isn't at least somewhat transparent, it'll display as if there was no mirror.
urphy's rules of combat
8 ) Teamwork is essential; it gives the enemy someone else to shoot at.
18 ) Make it too tough for the enemy to get in and you can't get out.

Dustin

  • Posts: 111
  • Turrets: +0/-0
    • http://alaric.ath.cx/~dustin/cms/index.php
Mirrors and "Cameras"
« Reply #6 on: July 10, 2006, 02:11:54 pm »
The shader is /usr/local/games/tremulous/base/scripts/common.shader (which the game itself says that it loads)
The map compiler claims no problems (it loads common.shader, it doesn't tell me that my texture is missing)
I am loading it with devmap.

...loading 'scripts/common.shader'
----- finished R_Init -----
...
...loaded 34 faces, 0 meshes, 0 trisurfs, 0 flares
CL_InitCGame: 36.70 seconds
8107 msec to draw all images
Com_TouchMemory: 0 msec
Dustin^7 entered the game
Dustin^7 joined the humans
]\quit

PS: Transparent?! Ack! Uh, Which colour is that? Or is it alpha-channel transparency? (I'm kinda used to birmap-type transparency, a certain colour is transparent).. Hold on, going to make a new image, transparent. I never had made a copy of (can't remember the name) the grey/white checkerboard one.

Stof

  • Posts: 1343
  • Turrets: +1/-1
Mirrors and "Cameras"
« Reply #7 on: July 10, 2006, 02:16:17 pm »
Alpha channel transparency will do. The fact is that the mirror shader will display that texture after it draws the reflexion and so, if it isn't at least somewhat transparent, nothing will show :)
urphy's rules of combat
8 ) Teamwork is essential; it gives the enemy someone else to shoot at.
18 ) Make it too tough for the enemy to get in and you can't get out.

Dustin

  • Posts: 111
  • Turrets: +0/-0
    • http://alaric.ath.cx/~dustin/cms/index.php
Mirrors and "Cameras"
« Reply #8 on: July 10, 2006, 02:28:40 pm »
With a tga image that's 100% transparent (as created by The GIMP with "Transparency" set for the background color), i've gotten closer than ever to my desired effect.
I got the hall of mirrors. At least it's somewhat mirrory, but not what I was aiming for ;)

Stof

  • Posts: 1343
  • Turrets: +1/-1
Mirrors and "Cameras"
« Reply #9 on: July 10, 2006, 02:33:34 pm »
Well, just for info, here is a shader I've done to display a mirrored floor :

Code: [Select]
textures/glass/mirrored_floor
{
    qer_editorimage textures/common/qer_mirror.tga
    portal
    {
        map textures/glass/16tile09.tga
        blendfunc blend
        depthWrite
    }
    {
        map $lightmap
        blendFunc gl_dst_color gl_zero
        rgbgen identity
    }
}
"


I know that one works but you still need a texture to go with it :)
urphy's rules of combat
8 ) Teamwork is essential; it gives the enemy someone else to shoot at.
18 ) Make it too tough for the enemy to get in and you can't get out.

Dustin

  • Posts: 111
  • Turrets: +0/-0
    • http://alaric.ath.cx/~dustin/cms/index.php
Mirrors and "Cameras"
« Reply #10 on: July 10, 2006, 02:52:07 pm »
Thank you for all your help, Stof. I suppose I can.. attempt.. to find/make a working texture to see if the texture has been my problem all along.

Edit: Strangely, the shader from pulse (for the monitors/cameras) just uses 2 images, which are merely black and white lines. They fail for me, of course ;), even using the shader that pulse used.

Stof

  • Posts: 1343
  • Turrets: +1/-1
Mirrors and "Cameras"
« Reply #11 on: July 10, 2006, 02:58:49 pm »
Thinking about that, I guess that shader can be used for a mirror and you won't even need a texture :
Code: [Select]
textures/glass/mirrored_floor
{
    qer_editorimage textures/common/qer_mirror.tga
    portal
    {
        map $lightmap
        blendFunc gl_dst_color gl_zero
        rgbgen identity
    }
}

You could try that :)
urphy's rules of combat
8 ) Teamwork is essential; it gives the enemy someone else to shoot at.
18 ) Make it too tough for the enemy to get in and you can't get out.

Dustin

  • Posts: 111
  • Turrets: +0/-0
    • http://alaric.ath.cx/~dustin/cms/index.php
Mirrors and "Cameras"
« Reply #12 on: July 10, 2006, 03:07:47 pm »


I may have to give up on this endeavour. It's been failing for 10 hours straight. It just isn't working out ;). I'll dabble with camera-portals, and then if that fails, go back to more .. normal .. stuff. Thanks :)

Somehow, (how? I have no idea what it was, maybe changing my all-black texture to half-transparent black (ah-hah!)) i got mirrors to work. Thanks for all your help, Stof!

xoltra

  • Posts: 5
  • Turrets: +0/-0
    • http://home.austin.rr.com/selliott4
Mirrors and "Cameras"
« Reply #13 on: March 12, 2007, 05:48:12 am »
I made a simple map with a mirror in it to see if I could do it.  It seems to work, so here it is:
http://home.austin.rr.com/selliott4/tremulous
The pk3 includes the map file (source) and textures it uses. I hope it is helpful.

Paradox

  • Posts: 2612
  • Turrets: +253/-250
    • Paradox Designs
Mirrors and "Cameras"
« Reply #14 on: March 12, 2007, 05:08:03 pm »
Heh, i should make a simple map made of nothing but portals and mirrors.

Ill call it hall of mirrors.

∧OMG ENTROPY∧

xoltra

  • Posts: 5
  • Turrets: +0/-0
    • http://home.austin.rr.com/selliott4
Mirrors and "Cameras"
« Reply #15 on: March 13, 2007, 12:35:37 am »
I thought that would be fun too.  So at one point I tried to make two adjacent sides of my simple mirror map (which only has six sides) mirrored (as opposed to the single side that is mirrored now).  Only one of two mirrors functioned at any given time.

Maybe the limitation is that only one of the surfaces of any given portal may be mirrored.  Maybe reflections of reflections are strictly forbidden by the game engine regardless of the number of intervening portals.  I didn't experiment to find out.

Also, I included the shader script I used with my pk3 (rather than using an existing one).  Here is the important part of that script:

Code: [Select]
textures/mirror/mirror_simple
{
        qer_editorimage textures/common/qer_mirror.tga
        surfaceparm nolightmap
        portal
        {
                map textures/mirror/mirror_simple.tga
                blendfunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
                depthWrite
        }
}

Paradox

  • Posts: 2612
  • Turrets: +253/-250
    • Paradox Designs
Mirrors and "Cameras"
« Reply #16 on: March 13, 2007, 01:00:45 am »
Naw, just make the portals >64u apart.

∧OMG ENTROPY∧