Phong shading + bumpmapping = delicious


(nUllSkillZ) #1

Hi,

Edit:

First a picture without bumpmapping / phong shading /fog:

just a short, very delicious, impression.

example shader:


textures/de_dustet2/stucco08d_bump
{
	qer_editorimage textures/de_dustet2/qer/stucco08d_qer.tga

	// PHONG
	q3map_nonplanar
	q3map_shadeangle 179
	// PHONG ENDE

	q3map_normalimage textures/de_dustet2/bump/stucco08d_bump.tga
	{
		map $lightmap
		rgbGen identity
	}
	{
		map textures/egypt_walls_sd/stucco08d.tga
		blendFunc GL_DST_COLOR GL_ZERO
		rgbgen identity
	}
}

Note:
phong shading - and bumpmapping part is taken from Q3Map2 tutorials at http://www.level-designer.de .

Credits:
m!chi.be

worldspawn:


"_lightmapscale" "0.0625"
"_fog" "textures/de_dustet2/sand_fog"
"classname" "worldspawn"
"mapcoordsmins" "-3584 4096"
"mapcoordsmaxs" "2560 -2048"
"farplanedist" "2048"
"fogclip" "2048"

compile options (not final):

  1. [li]BSP
    [/li]
    -meta

    [li]VIS
    [/li]
    -vis

    [li]LIGHT
    [/li]
    -light -fast -samples 2 -thresh 0.25 -external
Edit:

nvtool v 5.60 has been used to create the normalmap images.
parameter:

  • [li]Height Generation
    [/li][list:bf9ad5d0aa]
    [li]Filter Type
    [/li]9 x 9
    [li]Scale
    [/li]16

[/list:u:bf9ad5d0aa]


(Aikon) #2

K, that IS delicious … it looks almost as realistic as in rl :o !


(Shallow) #3

I think your q3map_shadeangle is a bit high - it looks like there is a bit of shadow bleed from inside the arch onto the wall at the top left of the arch.

I presume you’ll be using something like -bounce 8 for your final light compile - You would expect a lot of fill from bounced light in this sort of environment, at the moment you have none which looks a bit unrealistic. This will kill your bumpmapped shadows a bit, but to be honest I think you should only be considering using that sort of effect only in very limited areas rather than big expanses of exterior wall, as massively dense lightmaps do cause a big fillrate hit, and it’s not like people with less capable machines can switch to vertex lighting mode to avoid it as they can in Q3/RTCW. Q3 ‘art maps’ like Black Town have amply demonstrated that putting 0.000000000000025 lightmapscale on everything can bring ANY system to its knees, whilst stuff like Cardigan’s Estatica have shown that you can create beautiful lighting effects without huge framerate hits.

That said, as a beauty render, it’s very nice :slight_smile:


(nUllSkillZ) #4

I’ve edited the first post and have added a picture that shows the same wall without bumpmapping, phongshading and fog.


(MindLink) #5

your shadeangle is way too high for that geometry, should be max 90 (even better only 60 or so).


(nUllSkillZ) #6

Thank you for you suggestions, ideas, tips and hints.

I have forgotten the most important credit:
ydnar for his superp q3map2


(G0-Gerbil) #7

I presume you’ll be using something like -bounce 8 for your final light compile - You would expect a lot of fill from bounced light in this sort of environment, at the moment you have none which looks a bit unrealistic.
Personally while radiosity is nice from a techy point of view, I’ve found it adds very very little indeed to maps apart from sending compile times through the roof.
Consequently, I’ve never yet bothered to use it for a final compile. If I need specific lighting effects, I find it’s easier to chuck in low level point lights with a fade key to tweak - it’s so much quicker and more precise.

Nice pics, but yeah, the lightmap resolution is a ouchy.
A cheap effect you can do for some similar variation is in your terrain lightmaps just load 'em into an art package and give 'em some random noise.


(thore) #8

eeerrm. yeah, it DOES look delicious, but you do have to include the texture with your pk3, right?
i’m just wondering if it wouldn’t look strange if you have half of your textures applied phong+bump
to and the other half remains original as shipped with the game… on the other hand converting
ALL textures will largen file sizes…

is there a way of releasing a bumped+phonged texture set of all original textures so mappers and
players only have to DL a big file once that then could be used by any map?

last but not least i expect those eye candy stuff to minimize my yet so damn small framerates :smiley:


(nUllSkillZ) #9

As far as I know the normalmaps don’t have to be included.
And phong shading is achieved by two shader lines.
So no extra download.


(G0-Gerbil) #10

phong shading and normalmaps themselves shouldn’t affect framerates or filesize, it’s merely a different way of calculating the lightmap data.
The only reason i nthe top example it would increase filesize / decrease framerate is because you get the best effects in bumpmapping by having a high lightmap resolution, IE higher than normal, thassall.


(thore) #11

i though writing extra shaders for original textures is a big nono because those the
altered look will also apply to other maps who use this texture? but if it doesn’t add
to filesizes, go ahead. we all want to have ET look sweet as sugar :smiley:


(nUllSkillZ) #12

I don’t change the original shaders.
The path my shaders use is “textures/de_dustet2/…”.
So the original shaders stay original.
I only use the stock pictures in my shaders.


(G0-Gerbil) #13

There seems to be some misunderstanding here.
Even if nullskillz changed the official shaders (which he hasn’t, because he knows better), you wouldn’t suddenly miraculously get bumpmapping in the official maps.
Bumpmapping is a compile-time (lighting stage to be precise, but hopefully that’s obvious) only effect. This means without recompiling the official maps you can’t get bumpmapping on 'em.


(Mr_Tickles) #14

Woah, woah, woah, I though bump mapping had something to do with the way you create your texture in photoshop or whatever before hand not an option during compile time? ( Hmmm, on a side note, I’ve just had a sweet idea). Plus, as people have mentioned altering the original textures, and altering the original shaders, they are different. True, you can’t do either, but you can write your own new shader for an original texture. Sorry, maybe I read a few of the posts wrong.


(G0-Gerbil) #15

To create bumpmaps you need a normal map (a seperate image) - this is indeed something you need to create in an art package.
However, it’s only used to affect the lighting stage of compile - once the BSP is made you can ‘discard’ your normalmap (IE not package it in the PK3 to keep filesize down).


(Mr_Tickles) #16

Hmmm, ok, that’s interesting, thanks :slight_smile:
Sorry, got a few questions… maybe better to point me in the direction of a tut/explanation you think is good.
How exactly does the normal map work? Is it solely a greyscale image? I’m guessing that a whiter tone will give you increased brightness in that area, and a darker one, the opposite. How do you apply the normal map to the compiling process? [/annoying noobish questions]

Thanks for the reply :wink:


(nUllSkillZ) #17

All you need is a Photoshop plugin called nvtool (it’s from nvidia and I guess there’s also a tool from ATI available).
Then all you have to do is to load a picture into photoshop, use the nvtool filter, choose some options and then save the created picture.
The picture is blue / green.
Then you have to creat a shader (see above example without “// phong” to " // phong Ende").
And you are able to use bumpmapping in you map.


(Mr_Tickles) #18

Wow, cool, thanks a lot guys, will have to have a play around with this when I get home :slight_smile: