Bump maps not showing on vertex lit models

Discussion for Level editing, modeling, programming, or any of the other technical aspects of Quake
Post Reply
Cleric
Posts: 17
Joined: Thu Jan 19, 2012 2:41 pm

Bump maps not showing on vertex lit models

Post by Cleric »

Hi all, i got a problem I'm hoping someone can help me solve.
I made a simple model that is giving me some problems.
When vertex lit bump maps don't show, like they're not being used at all. When lightmapped, they're visible but then shadows look very bad, as though smoothing groups aren't being interpreted correctly.
I want to keep it vertex lit cause that way it looks very good but I'm not sure what to do to get the bump map to show properly.
Or is it impossible to do with vertex lit models.

Any help is appreciated.
g0th-
Posts: 262
Joined: Sat May 19, 2007 7:57 pm

Re: Bump maps not showing on vertex lit models

Post by g0th- »

the bumpmaps is not realtime in q3 it actually gets baked down on the lightmaps and thats why they dont show with only vertex llightning.
[url]http://www.g0th.se[/url]
Cleric
Posts: 17
Joined: Thu Jan 19, 2012 2:41 pm

Re: Bump maps not showing on vertex lit models

Post by Cleric »

g0th- wrote:the bumpmaps is not realtime in q3 it actually gets baked down on the lightmaps and thats why they dont show with only vertex llightning.
So there's no way around it huh.
Oddly enough I've just noticed the surface actually is showing some vague sings of a bump map being applied, but for some reason only in areas covered by shadows.
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Bump maps not showing on vertex lit models

Post by obsidian »

Nope, no way around it. The normalmap functionality with Q3Map2 isn't true bump/normalmaps as in other modern games. Normalmaps are rendered by the GPU as per-pixel shadows in realtime, where lightmaps are pre-rendered and the relative size of a luxel is comparatively low resolution. You're looking at completely different lighting systems.

For most models, I think it would be better if you had just painted in the light effects directly onto the model's texture.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
Cleric
Posts: 17
Joined: Thu Jan 19, 2012 2:41 pm

Re: Bump maps not showing on vertex lit models

Post by Cleric »

obsidian wrote:Nope, no way around it. The normalmap functionality with Q3Map2 isn't true bump/normalmaps as in other modern games. Normalmaps are rendered by the GPU as per-pixel shadows in realtime, where lightmaps are pre-rendered and the relative size of a luxel is comparatively low resolution. You're looking at completely different lighting systems.

For most models, I think it would be better if you had just painted in the light effects directly onto the model's texture.
I see your point. I guess shadow baking will be the best way to go.
Thanks.
Cleric
Posts: 17
Joined: Thu Jan 19, 2012 2:41 pm

Re: Bump maps not showing on vertex lit models

Post by Cleric »

I think bad lightmaps are caused by triangle merging. Several triangles are merged into one and then the lightmap looks wrong.
Is there a way to prevent merging?
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Bump maps not showing on vertex lit models

Post by obsidian »

What kind of models are these? Do you have a screenshot?

Most models will actually look far better vertex lit than lightmapped and I suspect that this is the case here.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
Cleric
Posts: 17
Joined: Thu Jan 19, 2012 2:41 pm

Re: Bump maps not showing on vertex lit models

Post by Cleric »

Yes i can make them vertex lit and the shadow will look just fine. But like the title of the thread says and you pointed out in your earlier post, vertex lighting and bump maps don't go together.
As you can see on those screenshots if the model is larger the lightmap is smoother. Larger polygons don't get merged (at least i think this is what is happening here).
When the model is in it's original scale a sharp transition is visible where the lightmap begins.
This is an .ase model, 300 polygons.
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Bump maps not showing on vertex lit models

Post by obsidian »

You wouldn't lightmap small detail models like that and you certainly won't have bumpmaps on them to any effect. Lightmapped models are designed for large scale objects like terrain, smaller detailed objects with a high triangle density will look better vertex lit.

The problem you are seeing with the hard edges has to do with the fact that lightmaps are 2D textures that are projected on surfaces axially, compounded with the relatively low resolution luxels.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
lightmill
Posts: 42
Joined: Sun Nov 27, 2011 11:27 am

Re: Bump maps not showing on vertex lit models

Post by lightmill »

try phong shader?
or do this thing with patches )
actually I have quite shitty lightmaps lighting on my models as well, much worse than what you get, I think it cant be helped
[url=http://twitter.com/back2cccp]twit[/url]
[url=http://slapmap.wordpress.com/]blog[/url]
[color=#BFFFBF]¯\_(ツ)_/¯ ----------------------------------------------------------------
[/color]
Cleric
Posts: 17
Joined: Thu Jan 19, 2012 2:41 pm

Re: Bump maps not showing on vertex lit models

Post by Cleric »

lightmill wrote:try phong shader?
or do this thing with patches )
actually I have quite shitty lightmaps lighting on my models as well, much worse than what you get, I think it cant be helped
Phong shader doesn't changes anything. And i made it a model so i can unwrap it and apply a texture properly.
Yeah it can't be changed. Surface has to be larger in order for the lightmap to be correct.
lightmill
Posts: 42
Joined: Sun Nov 27, 2011 11:27 am

Re: Bump maps not showing on vertex lit models

Post by lightmill »

True that, phong shaders don't seem to work on the models.
I can't get my models to light properly at all, smoothgroups work incorrectly and the model gets lightmapped even with no flags.. sigh
[url=http://twitter.com/back2cccp]twit[/url]
[url=http://slapmap.wordpress.com/]blog[/url]
[color=#BFFFBF]¯\_(ツ)_/¯ ----------------------------------------------------------------
[/color]
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Bump maps not showing on vertex lit models

Post by obsidian »

What program are you guys using to model with?

Phong shaders can work with lightmapped models, though smoothing groups and vertex lighting usually works better.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
lightmill
Posts: 42
Joined: Sun Nov 27, 2011 11:27 am

Re: Bump maps not showing on vertex lit models

Post by lightmill »

obsidian wrote:What program are you guys using to model with?

Phong shaders can work with lightmapped models, though smoothing groups and vertex lighting usually works better.

Model exported from max to .ase. Smoothed finely, looks smooth in radiant (so its not an exporter issue). Looks all wrong compiled either with vertex light or lightmaps. Phong shaders didnt help.
spawnflags 5 (cast shadow+ lightmapped)

q3map_nonplanar
q3map_shadeangle 179

compiled with -shade

[lvlshot]http://i.imgur.com/dAEZp.jpg[/lvlshot]

with no lightmaps it looks equaly unsmooth

(btw I googled your post on here that says phong shading doesnt help with models lightmapping)
[url=http://twitter.com/back2cccp]twit[/url]
[url=http://slapmap.wordpress.com/]blog[/url]
[color=#BFFFBF]¯\_(ツ)_/¯ ----------------------------------------------------------------
[/color]
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Bump maps not showing on vertex lit models

Post by obsidian »

I've had a similar problem before. What's the triangle count of the mesh? There seems to be some polygon limit for smoothing groups for either .ase files or how Q3/Q3Map2 handles them. Models with over ~1000 triangles seem to have unpredictable smoothing applied to them. Try exporting the model out as smaller chunks.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
lightmill
Posts: 42
Joined: Sun Nov 27, 2011 11:27 am

Re: Bump maps not showing on vertex lit models

Post by lightmill »

I did some testing and it seems smoothgroups are ignored completely.

Yes the model is big and about 10k polys.
I also use q3map2 from netradiant, its somewhat improved, maybe they changed something about model handling too

2.5.17n
Q3Map (ydnar) - v2.5.17n
NetRadiant - v1.5.0n Mar 9 2011
[url=http://twitter.com/back2cccp]twit[/url]
[url=http://slapmap.wordpress.com/]blog[/url]
[color=#BFFFBF]¯\_(ツ)_/¯ ----------------------------------------------------------------
[/color]
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Bump maps not showing on vertex lit models

Post by obsidian »

Have you tried testing it with a 1000 poly section of the model? I'm pretty sure that would fix the problem.

From the screenshot, smoothing groups are not completely ignored, they are just on and off on completely random spots, similar to what I had encountered before.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
Rav3n
Posts: 51
Joined: Sat Mar 12, 2011 7:50 pm

Re: Bump maps not showing on vertex lit models

Post by Rav3n »

obsidian wrote:Have you tried testing it with a 1000 poly section of the model? I'm pretty sure that would fix the problem.

From the screenshot, smoothing groups are not completely ignored, they are just on and off on completely random spots, similar to what I had encountered before.
Here's something that probably wont work.
How about splitting the model up according to smoothing groups.
It would be time consuming that's for sure. but it might just give better results if during the compile a lightmap is calculated for just one smoothing group instead of being forced to balance between multiple ones.
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Bump maps not showing on vertex lit models

Post by obsidian »

Rav3n wrote:How about splitting the model up according to smoothing groups. It would be time consuming that's for sure.
Exactly. It's actually quite easy, you can make selections in 3ds Max by smoothing group in the smoothing group rollout.
Rav3n wrote:it might just give better results if during the compile a lightmap is calculated for just one smoothing group.
Not exactly, it doesn't seem to matter how many smoothing groups you have applied to the object, just the number of total polygons.


Also, if you are lightmapping any model, you will almost certainly have lightmap seams somewhere on the model. As mentioned above, this is because the lightmaps are mapped onto the model axially so you end up with lightmap UV seams. It's like trying to wrap a sphere with a cubic UVW map, it has to place the seams somewhere. That's why sometimes you may want to vertex light the object, it may actually look better.

A handy trick might be to lightmap the top faces of the object (if you have stuff like trees on top casting shadows) and vertex light the bottom faces. You can set up a shader that uses q3map_alphaMod dotproduct affecting the lightmap stage.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
Cleric
Posts: 17
Joined: Thu Jan 19, 2012 2:41 pm

Re: Bump maps not showing on vertex lit models

Post by Cleric »

I managed to find a solution to my problem.
It was right there in front of me the whole time. -filter switch i was using to smooth out the shadows was blurring the lightmap, so when it was blurring a part of the lightmap on the model that was already pretty feathered it blurred it to the point where the lightmap no longer exists.
So the only thing that was visible from that point on was a part of the lightmap that was too "strong" to be blurred into smoothness.
When i removed the -filter switch those feathered parts of the lightmap became visible.
Also it look like light entities give much harder shadows that bring out the lightmap seams, shader lights are "softer" and don't cause this unless the light source is too close to the model and of high intensity.
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Bump maps not showing on vertex lit models

Post by obsidian »

Surfacelights can be just as "hard" depending on the shader script directives you set. Glad you found the solution.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
Cleric
Posts: 17
Joined: Thu Jan 19, 2012 2:41 pm

Re: Bump maps not showing on vertex lit models

Post by Cleric »

obsidian wrote:Surfacelights can be just as "hard" depending on the shader script directives you set. Glad you found the solution.
I read the shader manual but i can't seem to find those directives that will affect light attenuation or hardness, mind pointing me in the right direction? Or am i missing something obvious.
Post Reply