Quake3 bsp map : Shader issue, question.

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
bonsalty
Posts: 120
Joined: Thu Dec 10, 2009 1:30 pm
Location: Budapest,Hungary

Quake3 bsp map : Shader issue, question.

Post by bonsalty »

Hi, greetings! Please I need help:

I tried now Irrlicht example 16 and 21 to load my quake3 map (pk3 zip file containing scripts, texture, bsp), but found some issues (I get no load errors )
See picture:
Image

1) Transparent shaders are loaded as solid. See black text background, lack of transparency. (though some original transparent textures seem to get loaded properly (like
the lightbeam), some not)

2) Water is oscilating in sinus, but the wave grid is 10 times larger than it should be.
Some moving texture shaders like bubbles are moving in the opposite direction (down).
Water texture moves 10 times faster, oscilates like 10 times faster...

3) Some close planar surfaces intersect each other, causing vibration when the camera moves (no similar effect in game, honestly not a big problem just wondering why it
gets rendered uglier)

4) Unnecessary short mipmapping distance.



So the shaderscript file seem to get loaded since textures oscilate etc. Is it possible that irrlicht doesnt understand or misinterpretes some shadercodes.

Here are two shader examples for the bubbles, water and text:

Code: Select all

 
 
//--------- Shader for text ------------
 
textures/bkszt/aerob
{   surfaceparm nonsolid
    surfaceparm nomarks
    q3map_surfacelight 500
    surfaceparm trans
    qer_trans 1
 
    
    
    {
        map textures/bkszt/aerob.jpg
        blendFunc blend 
        rgbGen identity
        alphaGen const 0.1
    }
    {
        map textures/bkszt/aerob.jpg
        blendFunc add
        alphaGen const 0.1
    }
 
}
 
// ---------- shader for water  ----------------
textures/bkszt/water3a
 
    {
        qer_editorimage textures/bkszt/water3a.jpg
        qer_trans .3
        q3map_globaltexture
        surfaceparm trans
        surfaceparm nonsolid
        surfaceparm water
        surfaceparm nolightmap
 
        cull none
        tesssize 32
        deformVertexes wave 40 sin 2.5 2.5 2.5 2.5  
        
        { 
            map textures/bkszt/water3a.jpg
            
            //blendFunc add
            rgbgen identity
             blendfunc blend
                    alphaGen const 0.5
            tcmod scale -1 -1
            tcmod transform 2.5 2.5 2.5 1 1 1
            tcmod scroll -.11 .01
            tcMod turb 0 .1 0 .1
            
 
        }
    
    
             {
            tcgen lightmap
            map $lightmap
            blendfunc gl_dst_color gl_src_color
            rgbGen identity
            }
 
    }
 
 
// ------------ shader for bubbles ---------------------
 
textures/bkszt/bubble
        
    {
        qer_editorimage textures/bkszt/bubble.jpg
        qer_trans .3
        q3map_globaltexture
        surfaceparm trans
        surfaceparm nonsolid
        surfaceparm water
        surfaceparm nolightmap
 
        cull none
        
        
        { 
            map textures/bkszt/bubble.jpg
            
            //blendFunc add
            rgbgen identity
             blendfunc blend
                    alphaGen const 0.5
            tcmod scale -1 -1
            
            tcmod scroll 0.0 1
            
            
 
        }
    
    
    {
    tcgen lightmap
    map $lightmap
    blendfunc gl_dst_color gl_src_color
    rgbGen identity
    }
 
    }
 
 
 
Tomi
bonsalty
Posts: 120
Joined: Thu Dec 10, 2009 1:30 pm
Location: Budapest,Hungary

Re: Quake3 bsp map : Shader issue, question.

Post by bonsalty »

***** PARTIAL SOLUTION **********
I did not have time to check the irrlicht source code, but experimented little with the quake3 shader scripts, this is what I come up with:

1) ----------------- TRANSPARENCY PROBLEMS ----------
The support for the quake3 shaders for solids work fine, but transparency is an issue in irrlicht.
The following code does absolutely nothing good in irrlicht and should be reviewed in future, since other had same problems with transparent textures appearing as
black or solid with the engine:

Code: Select all

 
textures/bkszt/water3a
 
    {
        qer_editorimage textures/bkszt/water3a.jpg
        qer_trans .3
        q3map_globaltexture
        surfaceparm trans
        cull none
        tesssize 32
        deformVertexes wave 40 sin 2.5 2.5 2.5 2.5 
       
        {
            map textures/bkszt/water3a.jpg
            rgbgen identity
             blendfunc blend
             alphaGen const 0.5
            }
   
             {
            tcgen lightmap
            map $lightmap
            blendfunc gl_dst_color gl_src_color
            rgbGen identity
            }
 
    }
 
If you came across the same problem, you could replace the latter shader script definitions. To enable transparency here, GL_ONE GL_ONE as "blenfunc" should be called twice! ( tcgen lightmap and map $lightmap should be ignored). Here is the corrected version:

Code: Select all

 
textures/bkszt/water3a
 
    {
        qer_editorimage textures/bkszt/water3a.jpg
        qer_trans .3
        q3map_globaltexture
        surfaceparm trans
        cull none
        tesssize 32
        deformVertexes wave 10 sin 2.5 2.5 2.5 0.5 
       
        {
            map textures/bkszt/water3a.jpg
            rgbgen identity
             blendfunc GL_ONE GL_ONE
             alphaGen const 0.5
          
         }
         {
            map textures/bkszt/water3a.jpg
            rgbgen identity
             blendfunc GL_ONE GL_ONE
             alphaGen const 0.5
          
         }
       }
 
That corrects the problem, the solution is quite much the same as in quake3 game.
Image
2) ------------WATER OSCILATION PROBLEM ----------------------

Code: Select all

 
deformVertexes wave <div> <func> <base> <amplitude> <phase> <freq>
 
adjusting
- if the texture animation is too fast reduce the <freq> parameter
- if the wavegrid is too large increase the <div> number

3) ----------- BAD GRAPHICS, SHADERS DISAPPEARING IN STRIPES AS CAMERA MOVES AWAY
Dont know why, shaders might be looking awfull (I can post a comparison) in OpenGL - the partial solution is to use DirectX 9.
Tomi
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Quake3 bsp map : Shader issue, question.

Post by hybrid »

If you could dig into the sources and see if you can improve the shader handling it would be highly appreciated. This shader support was developed by only one guy who seems to have left quite some time ago (as many from the original team), so many parts of the engine are somewhat abandoned and we need people to take those things up. Small things are just as good to take.
If you're more into providing q3 scenes it would also be good to have a set of test environments which do show that certain things are working and some are not. Just for adding them into our test suite and making things easier to check when the sources are at some point changed.
Moving to bugs report as it's likely some :-)
bonsalty
Posts: 120
Joined: Thu Dec 10, 2009 1:30 pm
Location: Budapest,Hungary

Re: Quake3 bsp map : Shader issue, question.

Post by bonsalty »

I did not have time, later I will do that. Though the description for the alternative above will help for those who are having troubles with transparency and q3 water yet.
Tomi
Post Reply