Page 1 of 1
Bump maps not showing on vertex lit models
Posted: Thu Jan 19, 2012 2:50 pm
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.
Re: Bump maps not showing on vertex lit models
Posted: Thu Jan 19, 2012 2:55 pm
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.
Re: Bump maps not showing on vertex lit models
Posted: Thu Jan 19, 2012 3:05 pm
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.
Re: Bump maps not showing on vertex lit models
Posted: Thu Jan 19, 2012 4:23 pm
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.
Re: Bump maps not showing on vertex lit models
Posted: Thu Jan 19, 2012 4:29 pm
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.
Re: Bump maps not showing on vertex lit models
Posted: Sat Jan 21, 2012 11:42 pm
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?
Re: Bump maps not showing on vertex lit models
Posted: Sun Jan 22, 2012 4:25 am
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.
Re: Bump maps not showing on vertex lit models
Posted: Sun Jan 22, 2012 8:46 am
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.
Re: Bump maps not showing on vertex lit models
Posted: Sun Jan 22, 2012 4:32 pm
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.
Re: Bump maps not showing on vertex lit models
Posted: Mon Jan 23, 2012 8:48 pm
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
Re: Bump maps not showing on vertex lit models
Posted: Wed Jan 25, 2012 7:22 pm
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.
Re: Bump maps not showing on vertex lit models
Posted: Thu Jan 26, 2012 7:14 pm
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
Re: Bump maps not showing on vertex lit models
Posted: Thu Jan 26, 2012 9:30 pm
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.
Re: Bump maps not showing on vertex lit models
Posted: Thu Jan 26, 2012 10:25 pm
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)
Re: Bump maps not showing on vertex lit models
Posted: Thu Jan 26, 2012 11:12 pm
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.
Re: Bump maps not showing on vertex lit models
Posted: Thu Jan 26, 2012 11:32 pm
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
Re: Bump maps not showing on vertex lit models
Posted: Fri Jan 27, 2012 1:11 am
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.
Re: Bump maps not showing on vertex lit models
Posted: Fri Jan 27, 2012 7:19 am
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.
Re: Bump maps not showing on vertex lit models
Posted: Fri Jan 27, 2012 4:14 pm
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.
Re: Bump maps not showing on vertex lit models
Posted: Sat Mar 03, 2012 9:30 am
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.
Re: Bump maps not showing on vertex lit models
Posted: Sat Mar 03, 2012 4:22 pm
by obsidian
Surfacelights can be just as "hard" depending on the shader script directives you set. Glad you found the solution.
Re: Bump maps not showing on vertex lit models
Posted: Tue Mar 06, 2012 10:23 am
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.