Planetside Software Forums

General => Terragen Discussion => Topic started by: tempaccount on January 11, 2010, 04:18:20 AM

Title: Object usage questions/observations
Post by: tempaccount on January 11, 2010, 04:18:20 AM
Over the weekend I've been trying to figure out just how far I can go with an imported object, and here are some observations with questions attached - if anyone can answer these or throw their own observations in the mix it would be greatly appreciated! I'm pretty much a newb when it comes to object usage in TG2, I can pretty much just import my mesh from my application of choice and load it up in TG2.

I'm using 2.1 with Ray Trace Objects on. The mesh I'm using is very complex, around 2m triangles.

1. Reflections: If I have a very complex object mesh that has a water shader as a surface shader, it seems like the reflections and such are calculated per triangle. The quality of the reflections are very low and the mesh triangles become quite visible. Is there anything I can do to improve this or should I just forget using a water shader in an object? Using a reflective shader seems to work well, though. Thinking over this, it might be the transparency in the water shader causing this - I'll have to try a render with transparency turned off.

2. Transparency: I pretty much got simple transparency working using a simple water shader (using a trick detailed in this thread (http://forums.planetside.co.uk/index.php?topic=8031.0)), but I haven't really been able to improve it further. The object gets a very distinct outline, possibly due to overlapping triangles increasing the opacity around the borders.

3. Luminosity: I encountered the same sort of problem as in 1. I tried making a "sparkle" into my object using a surface shader with a luminosity function coupled into a power fractal (I got the idea from dandel0's snow thread here (http://forums.planetside.co.uk/index.php?topic=8434.0)). What I got was that a few of the triangles of the mesh were lit by the luminosity, but all detail was lost. Is this the same issue?

4. Bump: This works perfect, either through default shader or an image map shader. Ray Trace Objects needs to be on.

5. Texturing inside TG: Just as something simple, I tried using a simple powerfractal with color turned on as a surface shader for an object. What I got was an uniformly colored object - is this intended?

I'll try to provide images later on from the first problems. Thanks for looking!
Title: Re: Object usage questions/observations
Post by: Oshyan on January 12, 2010, 12:27:03 AM
1: If you're getting better results with a reflective shader than a water shader, it may well be the transparency. But you should be aware that the reflection calculations are currently limited in their detail for performance reasons, so that may be what you're seeing. Posting a rendered example would help to know for sure.

2: Transparency is optimized for use in water specifically, so it has some limitations as a result of that. General transparency improvements should be made in the future.

3: It would help to see a rendered example of this. It may be a "normals" issue. Is Smooth By Normals on in your object? Was this done as a separate test, or in combination with the reflectivity above?

5: Does your object have any UV maps? If so this may be causing a problem due to scale issues. To texture procedurally, it's easier to either have no UVs, or you need to adjust scales to work within the UV mapped area.

As noted (and coming soon, you mentioned), some image examples would be helpful in further diagnosing the problems.

- Oshyan

- Oshyan
Title: Re: Object usage questions/observations
Post by: tempaccount on January 12, 2010, 12:45:46 PM
Here's an example image of the aforementioned issue. The model has a water shader for transparency (it has reflectivity of 0), and a reflective shader with specular highlights turned on, but no ray-traced reflections.
Title: Re: Object usage questions/observations
Post by: Oshyan on January 12, 2010, 10:38:02 PM
It does appear that this may be a smoothing issue rather than an issue with the detail of reflection or transparency. Does the object render smoothly with the water shader turned off?

- Oshyan
Title: Re: Object usage questions/observations
Post by: tempaccount on January 13, 2010, 03:32:14 AM
It does. I suppose I should've rendered it without the transparency as well. The object has UV maps and has a normal map attached into it as displacement.

I wonder if it affects my other issues as well, if that's the case.
Title: Re: Object usage questions/observations
Post by: Oshyan on January 13, 2010, 03:37:02 AM
Does this happen with Raytrace Objects turned off?

- Oshyan
Title: Re: Object usage questions/observations
Post by: tempaccount on January 13, 2010, 03:50:35 AM
I think I've tried it and it does happen. I'm not 100% sure though. Could be I just tried Raytrace Objects off with the powerfractal texturing.

I can run a few more tests tonight.

Do you have a hunch which might be causing this? Either way I'm rather settled I should've made something simple for my first object test :p

Edit: One more thing: The water shader has decay distance of 1e+99 to accommodate for full transparency. If I drop the decay distance to a small number, the object renders fine, but of course there is no transparency.
Title: Re: Object usage questions/observations
Post by: Oshyan on January 13, 2010, 04:10:11 AM
I don't have a strong hunch, but your info about the transparency is interesting. Try this: render the same scene, do a crop of a small area of the model, and turn up Detail to 3 or 4.

- Oshyan
Title: Re: Object usage questions/observations
Post by: tempaccount on January 13, 2010, 04:38:12 AM
Ok, I'll try that tonight!

I have updated the model a little, but if I have the time I'll post renders of the aforementioned cases as well so it'll be easier to compare.
Title: Re: Object usage questions/observations
Post by: Matt on January 13, 2010, 12:02:38 PM
Quote from: tempaccount on January 11, 2010, 04:18:20 AM
5. Texturing inside TG: Just as something simple, I tried using a simple powerfractal with color turned on as a surface shader for an object. What I got was an uniformly colored object - is this intended?

There is a bug in 2.1.18.1 which requires objects to have UVs if they are ray traced. If you render without ray tracing, your objects do not need UVs.
Title: Re: Object usage questions/observations
Post by: tempaccount on January 13, 2010, 01:07:11 PM
Here's a few test renders. Render 1 is without transparency or reflectivity - the base of the model. Render 2 is with the aforementioned shaders - a water shader for transparency and a reflective shader with specular highlights turned on. Render 3 is with the default shader disconnected from the water shader input.

In other cases, the default shader has a displacement image (the exported normal map image for the mesh).

In closer inspection, the divider visible in render 1 (the darker and lighter parts) seems to go straight where the UV seam in the object goes. This seam seems to become visible even if I disconnect the parts shader and just plug a constant colour as the object's surface shader..

Edit: Tried a render with quality of 3, doing a crop around the tower. Issue still persists.
Title: Re: Object usage questions/observations
Post by: Matt on January 13, 2010, 05:34:47 PM
The "seam" looks like it might geometry self-shadowing, noticeable because of the low resolution of the mesh. I don't think it's a UV problem.

By the way, normal maps aren't the same as bump maps or displacement maps. TG will take the luminance of your map and turn it into displacement or bump, but this isn't what the normal map was intended for. The green channel has a greater weighting than red or blue when calculating luminance, so you will get some bump from this information, but it won't give you the normals that the normal map is supposed to.

I'm afraid I don't know exactly where the faceting is come from in the transparency or reflections. The Water Shader is only tested to work for the built-in displaceable objects, and even with those it can have issues with multiple entry and exit points for the rays.
Title: Re: Object usage questions/observations
Post by: Matt on January 13, 2010, 05:38:47 PM
Can you try export this geometry at high resolution without using a normal map?
Title: Re: Object usage questions/observations
Post by: tempaccount on January 14, 2010, 03:57:52 AM
Quote from: Matt on January 13, 2010, 05:38:47 PMCan you try export this geometry at high resolution without using a normal map?

Sure, I'll try that later tonight. Thinking about it, this might actually be the preferred step as opposed to exporting a low-poly model, if I'm rendering static scenes and objects especially with GI. You are right about the seam. You know, I actually thought I was exporting a high-poly mesh but this mesh has around 170k polys. Guess I'll put that one down to inexperience..
Title: Re: Object usage questions/observations
Post by: jaf on January 14, 2010, 02:34:08 PM
Quote from: Matt on January 13, 2010, 12:02:38 PM
There is a bug in 2.1.18.1 which requires objects to have UVs if they are ray traced. If you render without ray tracing, your objects do not need UVs.

I missed that one.  Is there a thread or reference that has more detail is it it for beta/alpha testers only?
Title: Re: Object usage questions/observations
Post by: Matt on January 14, 2010, 04:45:10 PM
jaf, I can't find the thread where it was reported, but it has been fixed for the next update.
Title: Re: Object usage questions/observations
Post by: tempaccount on January 14, 2010, 05:36:17 PM
I did a few renders with a mesh resolution of 600k faces, and it definitely solved all the other problems except the transparency issue which still baffles me. I changed the IoR to 1 in the water shader, and got a very "clear" result, so to speak :p
Title: Re: Object usage questions/observations
Post by: TheBlackHole on January 14, 2010, 10:38:13 PM
IoR 1 is equal to the IoR of air. You won't get any refraction out of it.
Title: Re: Object usage questions/observations
Post by: tempaccount on January 15, 2010, 01:19:04 AM
Quote from: TheBlackHole on January 14, 2010, 10:38:13 PMIoR 1 is equal to the IoR of air. You won't get any refraction out of it.

Exactly. You see the transparency issue very clearly there. I guess it's just something to do with optimization and the water shader isn't really meant to be used in that kind of situation.
Title: Re: Object usage questions/observations
Post by: Oshyan on January 15, 2010, 11:05:45 PM
Quote from: tempaccount on January 15, 2010, 01:19:04 AM
Quote from: TheBlackHole on January 14, 2010, 10:38:13 PMIoR 1 is equal to the IoR of air. You won't get any refraction out of it.

Exactly. You see the transparency issue very clearly there. I guess it's just something to do with optimization and the water shader isn't really meant to be used in that kind of situation.
Likely that's true, but in that case upping detail to 4 or so should compensate.

- Oshyan
Title: Re: Object usage questions/observations
Post by: tempaccount on January 16, 2010, 06:11:04 PM
Quote from: Oshyan on January 15, 2010, 11:05:45 PMLikely that's true, but in that case upping detail to 4 or so should compensate.

- Oshyan

True! It takes bloody ages but seems to work.

Thanks for the answers! I think for my next test I'll scrap the UVs from my object and try some sort of texturing inside TG2 with powerfractals.
Title: Re: Object usage questions/observations
Post by: Matt on January 16, 2010, 07:16:18 PM
UVs aren't the problem. And if you decide to work without UVs, bear this in mind:

Quote from: Matt on January 13, 2010, 12:02:38 PM
There is a bug in 2.1.18.1 which requires objects to have UVs if they are ray traced. If you render without ray tracing, your objects do not need UVs.

Matt
Title: Re: Object usage questions/observations
Post by: tempaccount on January 17, 2010, 05:15:59 AM
Quote from: Matt on January 13, 2010, 12:02:38 PM
There is a bug in 2.1.18.1 which requires objects to have UVs if they are ray traced. If you render without ray tracing, your objects do not need UVs.

Ah. I misunderstood this quote I suppose. When I have a simple powerfractal as the surface shader supplying color, with ray trace objects the object appears uniformly colored. With ray trace objects off, the surface shader works properly. I thought this problem was caused by having UVs. When the bug gets fixed, does it fix this issue as well or should I look into texturing the object outside TG2?
Title: Re: Object usage questions/observations
Post by: Matt on January 17, 2010, 12:52:15 PM
The bug is caused by not having UVs. If you have UVs, it should work the same with both rendering modes.

The bug is fixed for future updates.

The intended behaviour is that if you don't have any UVs the object gets default UVW texture coordinates in world space. In the current build with the bug these defaults only work with the micropolygon rasteriser, and the UVWs are 0,0,0 everywhere with the ray tracer.