Odd phong shading issues with models

Discussion for Level editing, modeling, programming, or any of the other technical aspects of Quake
Post Reply
dONKEY
Posts: 566
Joined: Mon Oct 15, 2001 7:00 am

Odd phong shading issues with models

Post by dONKEY »

This isn't a major deal, but I've run into an odd phong shading issue that might be a bug with q3map2's ase export function.
When I export an ase model via q3map2 and then import it back into Q3 my phong shaders don't work. If I run it through Blender first (in this case it was because I needed to edit the mesh slightly) then reimport back into Q3, the shaders suddenly do work.
I assume this is something to do with how q3map2 writes the ase file. Is there something that needs to be set on q3map2 generated ase models to get phong shading to work?

On a side note, which is how I stumbled across this issue...

Originally the corridor in question was made up of several smaller geometry section models. I rotated them on 45 degrees and moved into position. In GTK my models all align perfectly. After compile though I ended up with sparklies where q3map2 or Q3 had realigned my meshes. To get around the problem I combined all the smaller sections into 1 complete model and rotated it in Blender rather than in the editor. Is this behaviour normal? If model verts are off the Q3 grid does it try to correct them? Its not something I've come across before, but then I only normally rotate models I need to align axially.
It was when I imported my Blender mesh back into Q3 that the phong shader I had actually forgotten I was using magically worked on the new mesh.
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Odd phong shading issues with models

Post by obsidian »

Hmmm.... when compiling you shouldn't be getting sparklies on your models. Did the sparkles appear between the mesh and other meshes/brushes, or did you also get sparkles between polys of the same mesh?

I suspect it may have something to do with the rounding of vertex coordinate values or welding of collinear (is that the right term for vertexes? Two lines can be collinear, what do you call two points?) points. Got the before and after ASE files?

The only time I ever use brush to ase export is for scale comparison reasons so I never had this issue.
[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]
dONKEY
Posts: 566
Joined: Mon Oct 15, 2001 7:00 am

Re: Odd phong shading issues with models

Post by dONKEY »

It's between meshes I was getting sparklies. I guessed it was rounding issues. In-editor everything aligns, but the compiled map pulls the meshes apart. It was no major issue, I just had to build the entire rotated section outside the editor as a single mesh. I was just trying to save some work...which as I should know by know, always leads to more work in the long run!
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: Odd phong shading issues with models

Post by ^misantropia^ »

dONKEY wrote:This isn't a major deal, but I've run into an odd phong shading issue that might be a bug with q3map2's ase export function.
When I export an ase model via q3map2 and then import it back into Q3 my phong shaders don't work. If I run it through Blender first (in this case it was because I needed to edit the mesh slightly) then reimport back into Q3, the shaders suddenly do work. I assume this is something to do with how q3map2 writes the ase file. Is there something that needs to be set on q3map2 generated ase models to get phong shading to work?
Sounds like q3map2 isn't writing the surface normals correctly. Do you perhaps have an example map and model[1] for me?

[1] Preferably before and after export. It might be a bug that only exists in some versions of q3map2.
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Odd phong shading issues with models

Post by obsidian »

Yes normals might be the other thing. But if he mentioned the sparklies, it may also have to do with Q3Map2 not welding colinear edges, which might yield sparklies and would prevent the vertex normals from being calculated properly.
[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]
Kat
Posts: 952
Joined: Tue Nov 14, 2000 8:00 am

Re: Odd phong shading issues with models

Post by Kat »

Sparklies may simply be due to the rotation, if you don't get that absolutely correct in Blender your edges are going to be off grid and minute gaps will appear. Not sure why you're using phong on ASE models though, you've smoothgrouped the meshes right?
[url=https://www.katsbits.com/tutorials#q3w]Tutorials, tools and resources[/url]
dONKEY
Posts: 566
Joined: Mon Oct 15, 2001 7:00 am

Re: Odd phong shading issues with models

Post by dONKEY »

I thought smoothing didn't work?!
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Odd phong shading issues with models

Post by obsidian »

Smoothing groups works fine for me. Also make sure that you weld vertexes. If they are not welded, smoothing won't work. It may be also why you are getting sparklies. I've rotated some rather complicated off-grid models before and have never had them pull apart.

If you are lightmapping your models, it seems as if lightmaps are projected onto the model surface from an axial direction. This may mean that you'll still have lightmap seams on edges near the 45-degree mark. I've been trying to solve a problem with a vertical standing pipe model. Smoothing groups works fine. But lightmapped, I ended up with a lightmap seam on the 45-degree edges of the pipe. q3map_nonPlanar and q3map_shadeAngle didn't help. The only solution that I found was to vertex light the model, but that of course has it's obvious limitations. However, it looks acceptable as long as there are no detailed shadow edges intersecting it's surface.
[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]
dONKEY
Posts: 566
Joined: Mon Oct 15, 2001 7:00 am

Re: Odd phong shading issues with models

Post by dONKEY »

hmm, interesting. So I don't need to add phong shading into my mesh shaders?
Been doing that as a matter of course.
g0th-
Posts: 262
Joined: Sat May 19, 2007 7:57 pm

Re: Odd phong shading issues with models

Post by g0th- »

yeah I've been hiting my head agents that 45 degrees angles as well, I wish there was a way to use a second uv map for the lightmaps.
[url]http://www.g0th.se[/url]
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Odd phong shading issues with models

Post by obsidian »

g0th- wrote:yeah I've been hiting my head agents
So for failing their mission, you torture your best spies? Nice, though I like to punish failure with death via pit of flesh eating crabs.
[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]
dONKEY
Posts: 566
Joined: Mon Oct 15, 2001 7:00 am

Re: Odd phong shading issues with models

Post by dONKEY »

The 45 degree rotated passages I have I actually made on 45 degrees, rather than having to rotate the mesh after. It seemed to be the best solution to the problem
Post Reply