QuakeWorld.nu Forum

QuakeWorld.nu Forum

You are not logged in.

Announcement

Hi! Please read the rules. Please pay close attention to rules 1 & 5 in particular!

#1 25 Mar 2009 22:48:44

oneshotflinch
Member
Registered: 15 Apr 2006
Posts: 60

BSP Bump Mapping GLSL in EZQuake

http://www.quaketastic.com/upload/files/screen_shots/ezq_pertubation.png

As you see bump-mapping works but I am only computing a perturbation normal not a normal map normal. To get my light-direction I loaded a deluxe map I generated in FTE Quake which seems to be a stored average of all the light directions on the map. Unfortunately I am having a horrible time getting normal mapping working from here and I don't really see what the problem could be. For now I will have to put it on the back-burner unless someone can give me some direction. Theoretically there shouldn't be a problem since perturbation works and I seem to have the right tangent. Oh well, on to other things, I will revisit this later.

*Update - normal mapping fixed:

http://img18.imageshack.us/img18/6480/ezqbump.png

**Update Bump w/ Gloss:

http://img300.imageshack.us/img300/1913/ezqbumpgloss.png

Last edited by oneshotflinch (15 Apr 2009 17:11:52)

Offline

 

#2 26 Mar 2009 10:01:03

Zalon
Administrator
From: Silkeborg, Denmark
Registered: 28 Feb 2006
Posts: 1386
Website

Re: BSP Bump Mapping GLSL in EZQuake

Spike? big_smile

Offline

 

#3 26 Mar 2009 16:44:46

Spike
Member
Registered: 08 Feb 2006
Posts: 202
Website

Re: BSP Bump Mapping GLSL in EZQuake

.lux files should be in object space.
Just draw them without bumpmapping as a single texture and ensure that they're some sort of light shade of blue. That applies to your bumps/normalmaps too.
Basically the normalmap and lux map need to be similar colours (identical = no bumps, complete contrast = bumps going the wrong way).

Ensure the textures are normalised. FTE does this as part of lightstyle blending/uploading. I'm not sure how effective doing that in the glsl would be.

The maths you want is (normalmap dot lux) * diffuse * lightmap
There's no need to consider surface normals/orientation/rotation.

Happy now, Zalon?

Offline

 

#4 26 Mar 2009 17:09:55

Zalon
Administrator
From: Silkeborg, Denmark
Registered: 28 Feb 2006
Posts: 1386
Website

Re: BSP Bump Mapping GLSL in EZQuake

I'm always happy big_smile

Offline

 

#5 01 Apr 2009 01:52:38

oneshotflinch
Member
Registered: 15 Apr 2006
Posts: 60

Re: BSP Bump Mapping GLSL in EZQuake

Thanks for the reply spike. I finally had a chance to sit down and look at this again. My code was fine, the problem was because I accidentally was loading the spec map as the norm map (programming blunder of the year.) Here's just bump w/o spec:

http://img18.imageshack.us/img18/6480/ezqbump.png

Spike: The maths you want is (normalmap dot lux) * diffuse * lightmap

Multiplying the diffuse by the light-map gives me the wrong pixel values in glsl. In order to get the right values I do a blend:
vec3 pixel = mix(base_map.rgb, gl_TextureEnvColor[1].rgb, light_map.rgb);

This also has the added benefit of blending dynamic lights properly.

Offline

 

#6 01 Apr 2009 02:22:31

Spike
Member
Registered: 08 Feb 2006
Posts: 202
Website

Re: BSP Bump Mapping GLSL in EZQuake

Yeah, forgot to mention that normalmaps being textures (logically 0 to 1) means you need to scale and bias them in order to make them actual normalmaps, mneh. still, if it works it works.

Is it my imagination, or are you lighting the far side of the bricks? The lights on the wall highlight the bottoms of the bricks when there's meant to be a torch in that corner somewhere in the middle of the right edge. Certainly none at floor level. The floor also looks lit away from the corner rather than the parts that ought to be facing, though I'm not quite sure where the brighter lights are here.

Offline

 

#7 01 Apr 2009 02:44:39

oneshotflinch
Member
Registered: 15 Apr 2006
Posts: 60

Re: BSP Bump Mapping GLSL in EZQuake

It does look a little like that. I wrote a function that renders orbs at all the non-torch light locations. As you can see the torch lighting on the floor looks correct so I think the light-orb in the hallway is offsetting the wall lighting.

http://img18.imageshack.us/img18/7966/ezqbumplighting.png

Offline

 

#8 01 Apr 2009 03:28:29

oneshotflinch
Member
Registered: 15 Apr 2006
Posts: 60

Re: BSP Bump Mapping GLSL in EZQuake

I checked all the texture mappings and the only thing that seems inconsistent for causing a few lighting abnormalities is the deluxe-map. Is this how it looks in FTE or did I miss something:

http://img8.imageshack.us/img8/7694/ezqlux.png

Last edited by oneshotflinch (01 Apr 2009 04:09:11)

Offline

 

#9 15 Apr 2009 17:10:32

oneshotflinch
Member
Registered: 15 Apr 2006
Posts: 60

Re: BSP Bump Mapping GLSL in EZQuake

Bump/Gloss update:

http://img300.imageshack.us/img300/1913/ezqbumpgloss.png

Offline

 

#10 15 Apr 2009 17:30:07

Spike
Member
Registered: 08 Feb 2006
Posts: 202
Website

Re: BSP Bump Mapping GLSL in EZQuake

You know what the next step is though, right?

Use the blah_bump texture (presumably packing the heights into the alpha channel of the normalmap) and displace the texture based upon viewing angle.
So that your bricks really do stick out of the surface.

And yeah, when using bumpmapping, pre-baked lighting on your diffuse textures really does spoil the effect.

Offline

 

#11 15 Apr 2009 18:51:59

oneshotflinch
Member
Registered: 15 Apr 2006
Posts: 60

Re: BSP Bump Mapping GLSL in EZQuake

Yeah that's a good idea. Spike while I have your attention, I'm getting some strange behavior where at some angles the rendering of some (not all) faces gets fudged:

Here the face is wrong:
http://img148.imageshack.us/img148/8150/ezqglslerror.png

Here the face is correct:
http://img142.imageshack.us/img142/4651/ezqglslerror2.png

This problem seemed to have disappeared for a time and has recently returned. I'm guessing it has to do with some default behavior. Have you encountered this or any ideas what the problem could be?

Last edited by oneshotflinch (15 Apr 2009 18:52:58)

Offline

 

#12 16 Apr 2009 00:25:02

oneshotflinch
Member
Registered: 15 Apr 2006
Posts: 60

Re: BSP Bump Mapping GLSL in EZQuake

nvm it's just a problem with passing the texture coords so it's not related to anything else in the shader code which is why it's an intermittent problem.

Offline

 

#13 12 Jan 2010 20:38:35

dEus
Member
Registered: 27 Feb 2006
Posts: 682

Re: BSP Bump Mapping GLSL in EZQuake

bumping this with this.
any progress here? we could really use this!

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson