# Unity More Quake 3 map rendering problems

## Recommended Posts

Soul Reaver    108
Hi,

I'm still fighting to get Quake 3 maps rendered properly with Direct3D. As you can read here I have had serious problems with the Bezier patches. Well I didn't quite solve them I just switched to DirectX 10 and the artifacts disappeared. Also I stitched the subpatches together as jyk suggested.
But now I noticed some other problems:

First of all my texture and lightmap coordinates seem all to be wrong:
Texture and Lightmaps are off(Patches in Q3Dm17)
Quake 3 banner is mirrored(Q3Dm17)

The most obvious solution to this problem seemed like inverting the u-texcoord for all vertices:

vertex.texture = D3DXVECTOR2(1.0f - vertices[i].texCoord.x, vertices[i].texCoord.y);

But then this(Q3Ctf1, main room) will happen although the Quake 3 banner is rendered correctly.

Another problem which really distrubs me are certain artifacts(Q3Ctf1, flag room).

This happens when you look at the edges between patches and regular faces at a certain angle. You can see that the background is visible.

To sum this up:
-Texture and lightmap coordinates are wrong
-Strange artifacts

[Edited by - Soul Reaver on December 3, 2010 2:23:34 AM]

##### Share on other sites
Krohm    5030
If memory serves, q3a maps do have the lightmap uv coord stored explicitly. I'd say you're doing very wrong things with some alignments or vertex packings so they actually are "right" for coincidence more than everything else.

As for the banner: is this Q3DM17?
If it is, that piece of geometry did apply a shader. If the shader (as in Q3A .shader file) applied tcMod rotate (which is possible) then the texcoords will be all screwed. Did you check the shader?

Same thing for flames. Flames are animated and blended using Q3A shaders you have to parse. One of their features is that they can specify alpha maps independantly from diffuse RGB.
The flame shader in particular is likely additive, for which you correctly output black RGB as vertex color, but it seems the blendfunc is screwed up or the incorrect alpha is being supplied.

As for the final picture, what you're seeing is the typical flickering due to sub-pixel accuracy (a good thing) and FP errors (a bad thing).
Long story short: you must be sure patches are stitched correctly togheter, you cannot tassellate them independantly and hope to not experience that. Have a texture palette with "magnetic" vertices which you compare by some distance like (1/32, 1/64, values like that, on a per-group basis).

##### Share on other sites
Soul Reaver    108

the banner doesn't use a shader as far as I can tell, otherwise the application would fail to load the texture and it would appear black, also the effect int of that face equals -1 (just checked that).
Oh and what I meant with the other screenshot wasn't the flames but the texture above which is off if I invert the u-texcoord, if I leave it uninverted it is mapped correctly.

Quote:
 Have a texture palette with "magnetic" vertices which you compare by some distance like (1/32, 1/64, values like that, on a per-group basis).

Honestly, I don't get what you mean. Maybe because I don't know what a texture palette is. However I tried to solve this problem by a brute force attack (Just comparing each vertex with each other) a while ago. But as you can expect this resulted in very long load times and I don't even know anymore if it worked.

Oh and I am stitching the subpatches together, the problem is the transition between the patches and regular faces.

##### Share on other sites
jyk    2094
Quote:
 Original post by Soul ReaverOh and I am stitching the subpatches together, the problem is the transition between the patches and regular faces.
Just a minor note (and this may or may not be the cause of the problem you're seeing), but be sure that you use the actual end control points for the first and last points of each Bezier curve, rather than evaluating the curve at t = 0 and t = 1 and using the result.

(Realistically, evaluating at exactly 0 and 1 is likely to return the first and last control points exactly, I think. But, depending on how you're computing t over the curve, you can easily end up with a value that's not quite 1 for the last point. Better to just avoid any such problems entirely and use the first and last control points as is, IMO.)

##### Share on other sites
Krohm    5030
Quote:
 Original post by Soul Reaverthe banner doesn't use a shader as far as I can tell, otherwise the application would fail to load the texture and it would appear black, also the effect int of that face equals -1 (just checked that).
Then this isn't q3dm17 or your assets are screwed. This screen in q3dm17 applies a shader. Just run ioquake or vanilla to check. If this isn't q3dm17 please say so, because it look pretty much like the screen just below the red armor.
Quote:
 Original post by Soul ReaverOh and what I meant with the other screenshot wasn't the flames but the texture above which is off if I invert the u-texcoord, if I leave it uninverted it is mapped correctly.
Would you please crank up the brightness? I'm still having difficulties. Are you referring to the black corner just below the jawbone to the top-left corner of the door?
Quote:
 Have a texture palette with "magnetic" vertices which you compare by some distance like (1/32, 1/64, values like that, on a per-group basis).
Sorry, my fault here. There's should have been no "texture" in the statement above. I really meant to write "vertex palette" rather than "texture palette".
Quote:
 Oh and I am stitching the subpatches together, the problem is the transition between the patches and regular faces.
Excuse me, I really couldn't figure that out. I'd say Jyk is probably hitting the correct solution then.

Do yo mind more elaborations on all your problems? For first, where are the shots taken (map and rough position)?

##### Share on other sites
Soul Reaver    108
Okay, I changed my function to use the control points when the parameter is close (EPSILON) to 1.0f or 0.0f. Unfortunately it didn't resolve the issue. Thanks for the good guess anyway.

EDIT: It is indeed Q3Dm17 but there is no shader applied. The other map is Q3ctf1 just in the main room. And yes I mean the black areas of the geometry just above the door. Oh I just realized that the inverting process of the texture coordinate isn't even the cause of the glitch (it also happens with uninverted texcoords). Also I changed AddressU to Mirror and this is what I get. I guess this is how it is supposed to be BUT on the other side of the map (the map is symetric) the same piece of geometry is still wrong.

EDIT2: Okay my fault, the inverting proccess IS the cause of the texture glitch in Q3ctf1 (Visual studio refused to rebuild the project and I didn't notice it). So to sum this up:

Uninverted + Wrap: Banner mirrored, texture above door correct (on both sides)
Inverted + Wrap: Banner is correct, texture above both doors is wrong
Inverted + Mirror: Banner is correct, texture above one door is correct, above the other it is wrong

Btw, I added the map name and locations in my first post for each screenshot.

[Edited by - Soul Reaver on December 3, 2010 5:07:36 AM]

## Create an account

Register a new account

• ### Similar Content

• By dobbey
Who are you?
We call ourselves Dobbey. Our team currently consists of two people.
We are both early 20's and come from Germany. At the moment this is our hobby.
What's the name of the game and what is it about?
The game is called Insane and it is a 2D adventure puzzle game with horror elements.
Insane is about a scientist who has been doing human experiments for years.
His most successful experiment is number 73, which seems to be mentally labile.
This experiment manages to flee one day but can't distinguish between reality and imagination.
In this game you will find a creepy atmosphere with difficult and varied puzzles.
What inspired you?
The style of the game is inspired by Limbo. But we were also inspired by Jump 'n' Run games and movies.
Of course, we have also our own elements like an inventory system, butterfly effect, the "INSANE" effect, using a QR-Code..
Which program do you use to develop the game?
We are programming it with Unity. In our opinion, it is the best program for indie games.
And of course we are working with Photoshop to create the graphics.
What platform will Insane be available on?
For PC.
How can I support you?
Instagram:   http://bit.ly/2qwU2bl
Website:       http://bit.ly/2s8buqU

Here you can see some of our screenshots.

(You can find the animation on Twitter/Instagram.)

(You can find the animation on YouTube.)

What do you think about it?

Yo can see more screenshots or videos on Twitter, Instagram or YouTube.

• Hello, my name is Thomas and I am currently starting up a project.
The project is going to be a very hardcore, and tactical FPS that is similar to Escape from Tarkov. It will be made within Unity, and will be programmed in C#. Currently, I have a Unity project started, an organized Discord setup, and as well as a very organized Google Drive. The Google Drive has art references, and plenty of folders for organization. Lastly, the payment for this project will be solely rev-share as I have no money.
I am looking for anyone who can contribute: 2D artists, 3D artists, composers, programmers, etc.
If you would like to help out and be of use, please email me at: thomasmunson2277@gmail.com

• Score points by shooting enemies! Before you is one of the best representatives of the simulator sniper games genre, with stunning graphics, quality effects, and realistic ballistics of bullets. It will not be easy to win for sure. Are you ready? Then take a sniper rifle and fight!