Quake3World.com Forums
     Level Editing & Modeling
        Light styles and depthFunc equal compatibility issues


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




Print view Previous topic | Next topic 
Topic Starter Topic: Light styles and depthFunc equal compatibility issues

The hell good boy
The hell good boy
Joined: 22 Jun 2011
Posts: 1651
PostPosted: 01-03-2018 02:23 AM           Profile   Send private message  E-mail  Edit post Reply with quote


Hi. I'm trying to tweak little settings for each possible lightmapped shader to be hit by light styles by rearranging lightmap and texture order and inserting style marker between lightmap and texture stages:
Code:
textures/czq3dm1_tech/metb_grate1
{
    surfaceparm metalsteps
    surfaceparm nonsolid
    surfaceparm noimpact
    surfaceparm trans
    surfaceparm alphashadow
    cull none
    {
        map $lightmap
        tcGen lightmap
        depthFunc equal
    }
    q3map_styleMarker
    {
        map textures/czq3dm1_tech/metb_grate1.tga
        rgbGen identity
        blendFunc GL_ZERO GL_SRC_COLOR
        alphaFunc GE128
        depthWrite
    }
}

But here's the issue. It looks like I need to first write depth using alphaFunc to define depth and depthWrite to write depth into buffer before I can use depthFunc equal to use that depth buffer, which is incompatible with light style marked lightmapped shader. When I did this arrangement, the lightmap doesn't work in these shaders, resulting in grates being alpha masked and blended into background. In addition, it creates HOM effect when displayed over fog brush surface landed over skybox surface, which makes the texture pretty much rendered full-bright (in fact, I'm testing maps using devmap command to get rid of HOM effect by using r_clear cvar set to 1, which creates an ugly pink color, but it's still more nice to eyes than HOM effect).

And yes, this is Sock's industrial texturepack, being used in my currently WIP map Schöna. Since original texturepack doesn't have any shaders, I had to create some myself.

Styled light shaders look like following one:
Code:
textures/czq3dm1_tech/metb_light3_flicker
{
    q3map_lightimage textures/czq3dm1_tech/metb_light3_blend.tga
    q3map_surfacelight 250
    q3map_lightstyle 1
    qer_editorimage textures/czq3dm1_tech/metb_light3.tga
    surfaceparm nomarks
    {
        map $lightmap
        tcGen lightmap
    }
    q3map_styleMarker
    {
        map textures/czq3dm1_tech/metb_light3.tga
        rgbGen identity
        blendFunc GL_ZERO GL_SRC_COLOR
    }
    {
        map textures/czq3dm1_tech/metb_light3_blend.tga
        blendFunc GL_ONE GL_ONE
        rgbGen wave square 0 .5 .2 8
    }
    {
        map textures/czq3dm1_tech/metb_light3_blend.tga
        blendFunc GL_ONE GL_ONE
        rgbGen wave square 0 .5 .7 3
    }
}

All styled light shaders have style marker in order to get hit by its own style. Currently, only one light style is used, and that's this flicker effect. If you have better idea, how to make flickering light effect, that works good with in-game timeline, go ahead and tell :)



_________________
[ CZghost Gaming | Facebook | Twitter | YouTube | Google+ ]
While you feel the worst ever, turn around facing to Sun and all shadows will pass behind you.” - John Lennon


Top
                 

Gibblet
Gibblet
Joined: 17 Dec 2016
Posts: 10
PostPosted: 01-14-2018 12:09 AM           Profile Send private message  E-mail  Edit post Reply with quote


One approach, which I vaguely remember how this is done these days, but I recall using a shooter_plasma and disabling its sound somehow (encasing it in an invisible box of some type?), but unless you modify the source code it would be cyan colour and the projectile itself and impact effect would be visible. Modifying the source code to customise the colour/alpha and size, removing projectile and effects, disabling damage and making it silent, wasn't very difficult. This essentially leaves just a dynamic light.




Top
                 

The hell good boy
The hell good boy
Joined: 22 Jun 2011
Posts: 1651
PostPosted: 01-15-2018 07:47 AM           Profile   Send private message  E-mail  Edit post Reply with quote


LDAsh wrote:
One approach, which I vaguely remember how this is done these days, but I recall using a shooter_plasma and disabling its sound somehow (encasing it in an invisible box of some type?), but unless you modify the source code it would be cyan colour and the projectile itself and impact effect would be visible. Modifying the source code to customise the colour/alpha and size, removing projectile and effects, disabling damage and making it silent, wasn't very difficult. This essentially leaves just a dynamic light.

I'm afraid you just misclicked a topic. Or did you want to give me a suggestion? Because I've studied the shader syntax more in depth, with shader manual depository lookup and q3map_lightstyle creates actually static lightmap stages that are animated using rgbGen and alphaGen in that way it actually creates dynamically changing light, but it's not using entity generated dynamic lighting like rockets, but instead generates shader based fake dynamic lighting. It's actually static stationary light that is dimmed and lighted up dynamically by shader functions, like a lightbulb that is constantly lit up, doesn't change intensity, but its fixture contains a dimming sheet that dynamically changes the amount of light passed through. It's an illusion, but it works just like a charm. But my issue is that I can't quite place lightmap in first stage with depthFunc equal, using q3map_styleMarker afterwards and filtered texture with depthWrite in last stage, as it doesn't use the texture depth properly and therefore it renders without lightmap and texture blends in background. Funny thing is that skyblock can't render behind blended surface, and therefore it renders HOM effect, rapidly decreasing FPS rate...



_________________
[ CZghost Gaming | Facebook | Twitter | YouTube | Google+ ]
While you feel the worst ever, turn around facing to Sun and all shadows will pass behind you.” - John Lennon


Top
                 

Gibblet
Gibblet
Joined: 17 Dec 2016
Posts: 10
PostPosted: 01-17-2018 05:46 AM           Profile Send private message  E-mail  Edit post Reply with quote


I thought you were trying to make a flickering light, like a flame on a torch such as what can be seen in RtCW (which is why I brought it up, because the same thing can be done in Q3A with some source code tweaks), or a glowing alarm light, etc.
One thing about messing with the lightmap to do this - wouldn't that leave still the vertex shading on all items and players? Using the projectile trick would make things more uniform as an effect.
Sorry if I misunderstood. It was my impression, and decided to just throw it out there.




Top
                 

The hell good boy
The hell good boy
Joined: 22 Jun 2011
Posts: 1651
PostPosted: 01-19-2018 04:14 AM           Profile   Send private message  E-mail  Edit post Reply with quote


LDAsh wrote:
I thought you were trying to make a flickering light, like a flame on a torch such as what can be seen in RtCW (which is why I brought it up, because the same thing can be done in Q3A with some source code tweaks), or a glowing alarm light, etc.
One thing about messing with the lightmap to do this - wouldn't that leave still the vertex shading on all items and players? Using the projectile trick would make things more uniform as an effect.
Sorry if I misunderstood. It was my impression, and decided to just throw it out there.

It would be possible. But there is a problem. Entity vertex dynamic lighting is additive in Quake 3, not subtractive like lightmap. Therefore I couldn't make proper lighting using truly dynamic lighting as the texture would be barely visible. That's not how it works in real world. So sorry, I have to fake it using lightmap trickery, there's no other way...



_________________
[ CZghost Gaming | Facebook | Twitter | YouTube | Google+ ]
While you feel the worst ever, turn around facing to Sun and all shadows will pass behind you.” - John Lennon


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