Planetside Software Forums

Support => Terragen Support => Topic started by: N-drju on April 24, 2021, 02:02:20 PM

Title: Blender-made object shading horribly skewed
Post by: N-drju on April 24, 2021, 02:02:20 PM
Hello Guys,

Currently, I struggle with a very strange glitch which causes one of my objects in Blender to look like this when viewing it in Blender:


saywut1.jpg

The object consists of many vertices and it is quite high-poly. It is completely smooth. Yet, lots of the faces within are simply being displayed with all possible shades of grey, giving an impression of a rough surface.


I would not mind that of course if this was just a display glitch with no influence on the actual render. Unfortunately, the object is being rendered incorrectly in Terragen. The shading near its curved edges is completely inacurate:

saywut2.jpg

I'm helpless really... I tried to clean up the object in Blender, recalculate normals, remove doubles (there are none anyway) etc. Nothing works. Please help me understand what is going on here.
Title: Re: Blender-made object shading horribly skewed
Post by: archonforest on April 24, 2021, 02:15:10 PM
Perhaps you want to upload the blend file? I can take a look.
Title: Re: Blender-made object shading horribly skewed
Post by: N-drju on April 24, 2021, 02:43:50 PM
Quote from: archonforest on April 24, 2021, 02:15:10 PMPerhaps you want to upload the blend file? I can take a look.
Gladly, thank you for your offer Attila!

I'll have my dinner and will upload the file.
  ;)
Title: Re: Blender-made object shading horribly skewed
Post by: N-drju on April 24, 2021, 03:50:17 PM
Here it is. It's almost 100mb so I just offer a link to my Google Drive:

https://drive.google.com/file/d/1qMQf4IhYAj8yhgOB4ap4b4jovrmfmTNK/view?usp=sharing

Here is what I do in sequence and when the problem appears:

1. I create a 1.32 meter high and 0.01 meter wide plane object.

2. Then, I use the mirror modifier and translate the initial object to a desired spot.

3. Then, I subdivide the plane strip horizontally into about 750 edges.

4. I then grab the middle edge, pull it out and use inverse square profile to make a gentle curve...

5. ...after which I select one vertex line to spin the object to create a gently curving wall. This is were the object breaks apart.

I really wonder if you even see the object the same way like I do. In any case - do let me know about your findings.

I believe that this is some kind of a software problem and not hardware related - all of the objects created prior to this one load up and are displayed correctly.

EDIT: I just checked the object on my laptop and it looks just the same. Definitely not a hardware issue...
Title: Re: Blender-made object shading horribly skewed
Post by: archonforest on April 24, 2021, 04:09:41 PM
My blender is crashing on the file at opening. I have only 2.79 right now on the laptop front of me. Tomorrow I will check on my workstation where I have the latest Blender.

Otherwise I am not sure why you make this "simple" looking object like the way you wrote. At least on the picture the object look very simple.
Title: Re: Blender-made object shading horribly skewed
Post by: N-drju on April 24, 2021, 04:23:36 PM
Quote from: archonforest on April 24, 2021, 04:09:41 PMMy blender is crashing on the file at opening. I have only 2.79 right now on the laptop front of me. Tomorrow I will check on my workstation where I have the latest Blender.

Otherwise I am not sure why you make this "simple" looking object like the way you wrote. At least on the picture the object look very simple.
It's pretty large so maybe this is the reason why your laptop can't process it. I don't know its specs though.

I make it this way so I can create a symmetrical shape. Mirror modifier seems to be best to do it.

After some extra research myself, I can see that Blender seems to have problem resolving very thin objects. When the cable car's wall is about 10cm the problem doesn't seem to appear.

In any case, thanks again for your kind help. 
:)
Title: Re: Blender-made object shading horribly skewed
Post by: archonforest on April 24, 2021, 04:27:00 PM
Okay :)
Title: Re: Blender-made object shading horribly skewed
Post by: N-drju on April 24, 2021, 05:02:59 PM
Hmmm... Now it starts to get really interesting...

I've tried several more primitives with various amounts of edges and curving and they all break down as soon as the "mirror" modifier is applied... Always. :o The hell is that?

Can you confirm that Attila? Make sure to try the 2.8 build.
Title: Re: Blender-made object shading horribly skewed
Post by: archonforest on April 24, 2021, 05:16:05 PM
I can do it tomorrow only. Otherwise in general I have no problem with the mirror modifier. I made few things with it but worked as it suppose to be.
Title: Re: Blender-made object shading horribly skewed
Post by: KlausK on April 24, 2021, 08:39:48 PM
Hey there, can`t help you with Blender, really...but does this look any better to you? Rendered in TG.4.5.56.

CHeers, Klaus
Title: Re: Blender-made object shading horribly skewed
Post by: sboerner on April 25, 2021, 12:15:58 AM
That's a really beautiful shape, N-drju. And as KlausK shows it should render just fine.

The edges that you are seeing in the Blender 3D window and in your TG rendering are caused by using too many polys. I know this sounds counterintuitive. But when you subdivide your model so early in the process, any small rounding error in subsequent warps and transforms may prevent some of those tiny polys from deforming smoothly. And once they're out of kilter it's impossible to fix them. It's much better to start with as few polys as possible, apply a subdivision modifier, then adjust the cage to achieve the shape you want. Then, when you're happy with it, bake the subdivisions.

IMHO the main shell in this object has many more polys than you need. Probably 10-12K would be fine. I know this isn't a Blender forum but I'd be happy to share an example file if you are interested.
Title: Re: Blender-made object shading horribly skewed
Post by: N-drju on April 25, 2021, 11:34:52 AM
Thank you for your input @KlausK and @sboerner and for joining this discussion.

@KlausK - Yes, I think there is some improvement. But did you change something in particular? Either in Blender or TG?

@sboerner - Thank you for this information. That sounds reassuring. Perhaps I expect a little too much from Blender (and myself). I am a newbie to Blender really and I only did simple geometries (like houses) so far. I admit that there is a lot more to learn.

I presume this is indeed more of a Blender questions than TG one. My reasoning was that the object ends up in TG, so it doesn't really matter. :-X I look for solution in both TG and Blender after all.

Luckily, I remember that 1K+ users have the right to move topics to other sections, so I'll try it now.
Title: Re: Blender-made object shading horribly skewed
Post by: sboerner on April 25, 2021, 02:56:58 PM
QuoteI presume this is indeed more of a Blender questions than TG one. My reasoning was that the object ends up in TG, so it doesn't really matter. :-X I look for solution in both TG and Blender after all.
You're right. We all use TG in combination with other programs, so your reasoning makes sense.  :)

Take a look at this. This was built using your shape as a guide. Modeled mesh is on the left, model with mirror and subdivision modifiers is on the right. Slightly more than 11K polys, *should* be enough for rendering in TG but I didn't test it.

This is done in Blender 2.92. You should upgrade! They've made some amazing improvements.
Title: Re: Blender-made object shading horribly skewed
Post by: archonforest on April 25, 2021, 03:24:52 PM
Finally I manage to open your blend file. Holly molly! The polly count is insane for a model like this. Sboerner solved it correctly for you and the tips he wrote to you are 100 percent correct.
Title: Re: Blender-made object shading horribly skewed
Post by: N-drju on April 25, 2021, 03:59:28 PM
Here's the first wall with just 8 horizontal and 8 vertical edges:

saywut3.jpg

I did not check how it looks in TG but... damn...

Any ideas? I checked my GPU and CPU - both healthy. I'm fresh out of ideas.
Title: Re: Blender-made object shading horribly skewed
Post by: KlausK on April 25, 2021, 05:49:51 PM
This is what "wagonik4b_sb" looks like in TG.

@N-drju: I loaded your file into Blender 2.92, selected all parts in Layout mode
and then under "Object" I clicked "Shade Smooth". But I do not even know if that had any effect on your model.
Also - since I do not know anything of Blender - I do not know if that has any effect on the model or just the viewport representation.

Anyway, in your very first screenshot I can see that you have Xray mode turned on in the viewport.
Maybe that has something to do with how the model is displayed? Your last screenshot does not give (me) any clues whatsoever.

But as you can see, sboerners object model is the way to go.
It is not a software nor hardware problem, it`s your modeling technique.

CHeers, Klaus
Title: Re: Blender-made object shading horribly skewed
Post by: KlausK on April 25, 2021, 07:57:54 PM
This is by far a production ready object, and the form is not nearly as nice as your model.
I hope it proves my point about the modeling technique clearer (hope I did not offend you).
This is done by two extruded curves into a polygon object with only 1600 faces.
So there would be a lot of headroom for refinement. So you can get quite nice results with low poly count already.

Maybe you can make some time to watch a few online tutorials about organic or car modeling in Blender.
That might get you going faster, perhaps.

CHeers, Klaus

ps: I really like the soft rounded reflective shape :)
Title: Re: Blender-made object shading horribly skewed
Post by: N-drju on April 26, 2021, 02:49:57 AM
Quote from: KlausK on April 25, 2021, 07:57:54 PMThis is by far a production ready object, and the form is not nearly as nice as your model.
I hope it proves my point about the modeling technique clearer (hope I did not offend you).

No worries, no offence taken. I'm not an expert in Blender (just about a year's experience) so any tip or critique is welcome.

My reservations refer to the way in which light is being reflected off of the object where the outer wall starts to bend to the 70-90 degree direction. The same happens for the shadows which seem to have no falloff but are sometimes cut sharp at the bends, like in my first example. I think that in the case of a smooth wall, this should not be happening.

If not it might have something to do with how TG interprets the geometry, though I can't determine how much (if at all) it contributes to the effect. Just a rough guess.

Quote from: KlausK on April 25, 2021, 07:57:54 PMps: I really like the soft rounded reflective shape :)

You should see the final object then. I plan to share it in the file section when it's ready. I have identified some redundant faces so, hopefully, it'll be 10 - 20 mb smaller compared to now. :P
Title: Re: Blender-made object shading horribly skewed
Post by: sboerner on April 26, 2021, 08:59:09 AM
Check to make sure the object has smooth shading:
https://docs.blender.org/manual/en/latest/modeling/meshes/editing/face/shading.html

You may also want to enable Object Data Properties > Auto Smooth and set the angle at which Blender determines which normals should be flat or smooth.

But, seriously (based on what you've shown so far) this model should be a fraction of 100MB in size, maybe even less than 1MB depending on how much additional detail is added. (If you Google "blender subdivision modeling" you'll find some tutorials that show how to work with low-poly models and the subdivision surface modifier.)

Good luck with the rest of the project – looking forward to seeing the final model.
Title: Re: Blender-made object shading horribly skewed
Post by: N-drju on April 29, 2021, 04:54:44 PM
Let me go back to this topic one more time and say that you Guys are the best! :)

I currently work on seats for my "vehicle" and the subdivision modifier you hinted at works wonders! Not only the object's shading is correct but it is also very easy to control it's shape and all that by just using a very basic, angular lattice. Something that is basically impossible to do without this modifier's help. How convenient!

fotel.jpg

Now I really gotta find a solution to the huge file size my objects swell to (this chair is already 90mb). I'm proud my new machine can handle them. 8) But it's still too much nonetheless!
Title: Re: Blender-made object shading horribly skewed
Post by: sboerner on April 29, 2021, 08:51:53 PM
Beautiful work! Very nice model.

I would seriously recommend keeping your poly counts down, especially for things that aren't hero objects. Inflated poly counts just increase your wait time and workload all along the pipeline – modeling, mapping, shading, rendering. This model may be "only" 90 MB . . . but when you combine 2 (or 4) of them, plus the ship, plus passengers . . . you get the idea.

One advantage of using the subdivision modifier is that you can model at high resolution, then reduce it for export depending on how the object is going to be used.

But keep up the great work. Looks like you've got the hang of it.
Title: Re: Blender-made object shading horribly skewed
Post by: Dune on April 30, 2021, 02:15:45 AM
Looks really good indeed. But I'd say a model like this can be under 10MB.
Title: Re: Blender-made object shading horribly skewed
Post by: N-drju on April 30, 2021, 05:22:08 AM
Quote from: Dune on April 30, 2021, 02:15:45 AMLooks really good indeed. But I'd say a model like this can be under 10MB.

;D :o

The original lattice is already 10MB being just an angular skeleton, far from anything that could be presented to the public. I hardly believe it can be reduced to less than 10MB without sacrificing quality. But yes, I do agree that I need to find a way to cut down on the size.

There are numerous little options in Blender that have an influence on Blender rendering but do not seem to have any impact on an exported object in Terragen...

What I wish to do today, is to uncheck every box and disable any feature that seems redundant from the TG point of view and see if that helps.
Title: Re: Blender-made object shading horribly skewed
Post by: Dune on April 30, 2021, 09:58:52 AM
Quality (mesh count) probably also depends on where in the scene this chair will be. The further, the lower...
Title: Re: Blender-made object shading horribly skewed
Post by: WAS on April 30, 2021, 01:16:14 PM
Yeah working with as low as polys and only subdividing at the end, to a desired look, is crucial to keep filesize down.

Though you could take your final and run it through MeshLab or other programs with smart decimation algorithms to create distant low poly versions like Ulco was hinting at (if it's far away swapping to a lower poly version would help with scene management).

Though I think TG needs a object swapping function that literally transitions between models during sequence so these aren't a "pop" event if visible.
Title: Re: Blender-made object shading horribly skewed
Post by: sboerner on April 30, 2021, 04:36:22 PM
QuoteThe original lattice is already 10MB being just an angular skeleton, far from anything that could be presented to the public.


My goodness. That just seems unreasonably large. Is that the .blend size or the exported .obj file size? You can reduce the size of the .blend file by purging orphan data. It's a good idea to clean that out once in a while. (Always make a backup first, of course.)

How many levels of subdivision in the modifier? It depends on the model, but I rarely go above 2, and never above 3.

By way of comparison, the .obj file for the packet boat model I posted a few weeks ago is 15 MB, about 102,000 polys. That includes the smooth hull and highly subdivided geometry of the brass railings and coiled rope, and UVs too of course. (Adding here again so you don't have to go looking for it. :) )
Title: Re: Blender-made object shading horribly skewed
Post by: N-drju on April 30, 2021, 05:26:02 PM
Quote from: sboerner on April 30, 2021, 04:36:22 PMMy goodness. That just seems unreasonably large. Is that the .blend size or the exported .obj file size?

To answer your question, it is the size of the .blend file (modifiers not yet applied). But it looks like you were right Guys. Again!

Today, I indeed worked to see what I can do to reduce the file size. My seat currently stands at 90mb after export... Here's what I did...

I reduced the subdivision count for some of the surfaces (from 6 to 3 in some cases :o).

Then, I removed as many "invisible" faces as I could. By that, I mean the ones that are simply obscured by other geometry and, essentially, useless.

I have also discovered that it is possible to cut down the file size by a third, simply by unchecking the "write normals" dialogue box on export.

normals.jpg

I'm not really sure what this feature does... The fact remains that the file size has dropped considerably when this was unchecked.

Cumulatively my 90mb armchair dropped down to just 17mb. :) Here's what it looks like now:

seat.jpg

It seems that unchecking the "write normals" option does not have too much of an influence on how an object will be rendered in TG, though I still have to run a test or two. The only "price" is that objects are entirely black in the "smooth shading" view option in TG, but I can live with that most of the time. In any case, I consider it an interesting find and objects seem to render just fine.
Title: Re: Blender-made object shading horribly skewed
Post by: sboerner on April 30, 2021, 10:00:15 PM
Good work! That sounds like a more appropriate size for a model like that.

Quote from: undefinedI'm not really sure what this feature does... The fact remains that the file size has dropped considerably when this was unchecked.

From the docs (https://docs.blender.org/manual/en/latest/addons/import_export/scene_obj.html):


Quote from: undefinedWrite Normals
Write out Blender's face and vertex normals (depending on the faces smooth setting).
Mostly this isn't needed since most applications will calculate their own normals but to match Blender's normal map textures you will need to write these too.

So it would seem that Terragen's 3D preview requires the written normals, but the renderer does not, which makes sense. (Using baked-in data would speed up the preview.) Not sure I could do without proper shading in the 3D window. But if it doesn't bother you, why not?
Title: Re: Blender-made object shading horribly skewed
Post by: Dune on May 01, 2021, 02:09:15 AM
I sometimes don't use calculated nomals in hair from ZB fibermesh. It looks awful in preview, but indeed renders fine. And is lighter MB-wise.
Title: Re: Blender-made object shading horribly skewed
Post by: KlausK on May 01, 2021, 04:36:41 AM
Doesn`t PoseRay write normals, when you just load and save a object?
I seem to remember I had that issue of the black preview surface sometimes and fixed it with PoseRay...
Maybe worth a try.

CHeers, Klaus
Title: Re: Blender-made object shading horribly skewed
Post by: N-drju on May 01, 2021, 07:20:50 AM
Quote from: KlausK on May 01, 2021, 04:36:41 AMDoesn`t PoseRay write normals, when you just load and save a object?

I think you are correct but it probably negates the initial savings in the file size.
Title: Re: Blender-made object shading horribly skewed
Post by: WAS on May 01, 2021, 01:19:26 PM
Quote from: sboerner on April 30, 2021, 10:00:15 PMSo it would seem that Terragen's 3D preview requires the written normals, but the renderer does not, which makes sense. (Using baked-in data would speed up the preview.) Not sure I could do without proper shading in the 3D window. But if it doesn't bother you, why not?

Though if we're calculating normals (in object meshing in TG) where by default this is happening, it should just be cached from the get go, used for 3D and final render. The current working model seems just poorly done since TG can and does recalculate normals by default.

Additionally, referencing a cached TG-ified model should actually be faster than referencing the obj on disk, and re-applying TG modifiers at render time every render.

Ex. I load two of the same objects, one just has a different colour/lum or something. TG is going to reference the original model and apply modifiers like recalculating normals on both objects at render time. It could just do this at load, make a cached object, lets say Terragen Cache Object (TCO) in Terragen cache, and reference that model while TG is running. Maybe if gathering a project it spits out TGO alts then from the original OBJ/LWO files with modifiers and shader adjustments.