Quake3World.com Forums
     Level Editing & Modeling
        I'm having a few issues with lightmaps and alpha channels


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




Print view Previous topic | Next topic 
Topic Starter Topic: I'm having a few issues with lightmaps and alpha channels

Insane Quaker
Insane Quaker
Joined: 06 Nov 2011
Posts: 250
PostPosted: 04-11-2016 06:34 AM           Profile Send private message  E-mail  Edit post Reply with quote


I've been working on this map for probably over a year, constantly dissatisfied with how it looks and how it plays - recently I decided the gameplay is good enough, and I'm going to release it as it is with just some lighting. However, I'm running into some really annoying lighting bugs...



Attachment:
glass.png
glass.png [ 2.84 KB | Viewed 5345 times ]


There's this glass shader, which has a border and the center is blank. When I render lighting, it creates a lightmap that covers the entire surface, including the blank centers of the glass. No combination of alphaFunc or blendFunc create exactly the result I'm looking for, which is lightmaps only on the glass borders.

Code:
textures/mc/49
{
   qer_editorimage textures/mc/49.tga
   qer_alphafunc greater 0.5
   qer_trans 0.75
   q3map_lightmapSize 512 512
   q3map_lightmapBrightness 2.0
   q3map_alphaShadow
   q3map_lightFilter
   q3map_nonplanar
   surfaceparm trans
   {
      tcgen lightmap
      map $lightmap
      rgbGen identity
      blendfunc filter
   }
   {
      map textures/mc/49.tga
      alphaFunc GE128
      rgbGen identity
   }
}


I'm not sure what else to put here, any help is appreciated, and anything you need to know I'll try and answer... this is really bothering me. I just want to release a damn map!




Top
                 

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 44131
PostPosted: 04-11-2016 06:51 AM           Profile   Send private message  E-mail  Edit post Reply with quote


Wow, what is all that info on your screen?




Top
                 

Insane Quaker
Insane Quaker
Joined: 06 Nov 2011
Posts: 250
PostPosted: 04-11-2016 07:16 AM           Profile Send private message  E-mail  Edit post Reply with quote


Eraser wrote:
Wow, what is all that info on your screen?

That's the kind of stuff you can see in Defrag. On the bottom-left is movement info - jump distance, angles, jump acceleration, jump speed, jump height, overbounces, X/Y/Z velocity... On the middle-right is simply movement speed, overbounces, and distance from crosshair. There are some pretty cluttered HUDs in Defrag :olo:




Top
                 

Etile
Etile
Joined: 19 Nov 2003
Posts: 34898
PostPosted: 04-11-2016 01:05 PM           Profile Send private message  E-mail  Edit post Reply with quote


that looks an awful lot like the glass texture from sphax's purebdcraft set

is this an MC-inspired map?




Top
                 

Insane Quaker
Insane Quaker
Joined: 15 Feb 2010
Posts: 298
PostPosted: 04-11-2016 01:56 PM           Profile Send private message  E-mail  Edit post Reply with quote


The important missing keys are:

depthWrite in the stage with the alpha-channel texture using one of the alphaFuncs.
depthFunc equal in the lightmap stage.

Code:
textures/mc/49
{
   qer_editorimage textures/mc/49.tga
   qer_alphafunc greater 0.5
   qer_trans 0.75
   q3map_lightmapSize 512 512
   q3map_lightmapBrightness 2.0
   q3map_alphaShadow
   q3map_lightFilter
   q3map_nonplanar
   surfaceparm trans
   {
      map textures/effects/tinfx3.tga
      blendfunc add
      rgbGen identity
      tcGen environment
   }
   {
      map textures/mc/49.tga
      alphaFunc GE128
      rgbGen identity
      depthWrite
   }
   {
      map $lightmap
      blendfunc filter
      rgbGen identity
      tcGen lightmap
      depthFunc equal
}

The first stage in this example is optional. ;)



_________________
Q3A Maps - by sst13
Quake Live Workshop


Top
                 

Insane Quaker
Insane Quaker
Joined: 06 Nov 2011
Posts: 250
PostPosted: 04-12-2016 01:32 PM           Profile Send private message  E-mail  Edit post Reply with quote


Thank you!! That appears to have worked, thank you very much for the help.

Yes, it's a Minecraft map, if you had even looked at the thumbnail of the video you would have noticed that :o




Top
                 

Insane Quaker
Insane Quaker
Joined: 06 Nov 2011
Posts: 250
PostPosted: 05-03-2017 04:54 PM           Profile Send private message  E-mail  Edit post Reply with quote


Now, for a nice necro post:

Is it possible to put lightmaps on a "blendFunc blend" shader in the same fashion? ie. so that the lightmap is only on the visible portions.




Top
                 

The hell good boy
The hell good boy
Joined: 22 Jun 2011
Posts: 1922
PostPosted: 05-04-2017 11:44 PM           Profile   Send private message  E-mail  Edit post Reply with quote


There are still people who play DeFrag? I tried it once but didn't fit well in my preferences, so I leaved DeFrag for ever, playing only vanilla Q3 and TA...

EDIT: The same method for blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA (aka blendFunc blend) doesn't work well, since the shader interpreter has no information about depth equality, alpha channel doesn't contain any information about depth and lightmap doesn't have alpha channel to be applied, so it would create nasty dark area throughout the texture with alpha channel.
With only blendFunc blend it's impossible to create a depth with depthWrite (it would create entire rectangle area filled, so nothing changed) as depthWrite needs a binary alphaFunc to work properly. Binary as it accepts a boolean value opaque/transparent, which is constructed on simple condition accessed to alphaFunc (GT0 = greater than 0 is opaque - creates nasty jagged edges, LT128 = less than 128 is opaque - inverts transparency, smooths out edges, GE128 = greater than or equal 128 is opaque - creates nice smooth edges)

You can, of course, combine those alphaFunc and blendFunc together, it will work. For best result I'd recommend to use alphaFunc GE128 together with blendFunc blend.



_________________
[ Websites | Facebook | Twitter | YouTube | Instagram ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon


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


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.