Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] Bug Reporting => Topic started by: romullus on 2017-10-13, 21:20:08

Title: Improve wireframe rendering
Post by: romullus on 2017-10-13, 21:20:08
It always bothers me why Corona does so bad job when rendering wire map on grazing angle surfaces. Is it because of filtering bluring? If so, can we have exposed that parameter in wire map GUI, so we can tweak it and try to find optimum value?
Title: Re: Improve wireframe rendering
Post by: pokoy on 2017-10-13, 21:43:50
Ouch. Does changing the image filter to other modes help with this in any way?
Title: Re: Improve wireframe rendering
Post by: romullus on 2017-10-13, 22:00:59
I don't think that image filtering could help here a single bit, but i'll try it anyway.

Edit: nah, change between various filtering methods and even no filter at all, is barely perceptible.
Title: Re: Improve wireframe rendering
Post by: pokoy on 2017-10-13, 22:06:12
I thought since it's not a texture map it's filtered through AA which would be done in the image sampler... Could be wrong, of course.
Title: Re: Improve wireframe rendering
Post by: burnin on 2017-10-14, 01:22:19
yup, play with AA or set the resolution higher then downsample
Title: Re: Improve wireframe rendering
Post by: romullus on 2017-10-14, 10:18:47
Nope and nope. It's wire map's fault, it can't be fixed by image filtering nor by downsampling.
Title: Re: Improve wireframe rendering
Post by: burnin on 2017-10-14, 14:21:51
Ah, OK.
So to clear things out... Do you mean thicker lines on the sides (grazing angles) of your object?

Is this looking fine? (from C4D latest daily, 1.7 RC8)
(https://i.imgur.com/gS8YJaU.jpg)
Title: Re: Improve wireframe rendering
Post by: PROH on 2017-10-14, 15:43:23
The only "solution" I've found so far, is to use real world size instead of pixels. Have you tried that?
Title: Re: Improve wireframe rendering
Post by: romullus on 2017-10-14, 16:30:51
@burnin, yes extremelly thick lines at grazing angles is the thing that bothers me. Most of the time it's barely noticeable, but in certain scenarios it sticks like a sore thumb. Your exmple looks fine, but try to place the camera directly above the bottle and then move it slightly to the side, so side wall of the bottle would be visible at very grzing angle - you should get similar effect as in my example.

@PROH, thank you, world size indeed looks like a solution in that case. It's less convenient to use and in some scenes probably won't give acceptable results, but at least now, i'm pretty happy :]
Title: Re: Improve wireframe rendering
Post by: maru on 2017-10-14, 18:19:25
With px size it is expected that the further lines will appear thicker, because they will be the same thickness as the closer ones.
Other than that I think rendering a bit more passes would improve quality because of AA.
Title: Re: Improve wireframe rendering
Post by: romullus on 2017-10-14, 19:04:28
Those lines are clearly NOT the same thickness. And i don't think that such result is expected. I've attached zoomed in version, so you can better see what's going on. Pix size in this render was set to 1 px, but in output, wireframe came out 9 px wide. No amount of AA would ever deal with this.
Title: Re: Improve wireframe rendering
Post by: burnin on 2017-10-14, 22:35:25
Ah, yes.

(https://s1.postimg.org/6m3cdqjlwv/c_Wire_Shader-_Width.gif)

Pixel width size is screen space relative.  Feels like some kind of border case bug.

Next example shows camera moved by a small margin (~0.1mm)

(https://s1.postimg.org/4g3xryt0qn/wire-samples0000.jpg)
(https://s1.postimg.org/7eg7vh12i7/wire-samples0001.jpg)

I wonder if it's precision issue? Can it be solved? How then & is it worth it?

Had occasionally observed similar in blenders freestyle, bypassed by doing larger viewport render and composited back. Since i never used for more than an informational value (no artistic or other meaning). 

PS
It's also the reason why i prefer working with World units (also for bump&displace), as i know better what to expect - i often switch through different previews (formats, angles, resolutions) during workflow. But as it can be seen, both approaches have their pros & cons.
Title: Re: Improve wireframe rendering
Post by: romullus on 2017-10-14, 22:52:40
I don't think it's borderline case, I'm doing quite a few wireframe rendering and this behaviour bothers me a lot. Issue is less noticeable when choosing sub-pixel line width, but is very evident (and ugly) when line width is ≥ 1 V-Ray can render perfect wireframes in both modes and i believe that Corona should be able too.
Title: Re: Improve wireframe rendering
Post by: burnin on 2017-10-15, 02:28:19
Yup, i agree & support your effort for improvement. The more i think about it, this should be reported as a bug... & hopefully VRay tech will come to the rescue ;)
Title: Re: Improve wireframe rendering
Post by: maru on 2017-10-16, 09:52:58
Ok, something is definitely wrong here.
In the image from the 1st post I thought the thick lines are actually multiple edges.
Title: Re: Improve wireframe rendering
Post by: Frood on 2017-10-16, 12:11:17
And please:

https://forum.corona-renderer.com/index.php?topic=12432.msg80188#msg80188

Which tried to be a gentle reminder for:

https://forum.corona-renderer.com/index.php/topic,10093.msg64388.html#msg64388



Good Luck


Title: Re: Improve wireframe rendering
Post by: -Ben-Battler- on 2017-10-16, 14:22:45
And please:

https://forum.corona-renderer.com/index.php?topic=12432.msg80188#msg80188

Which tried to be a gentle reminder for:

https://forum.corona-renderer.com/index.php/topic,10093.msg64388.html#msg64388

Good Luck

hah, good to see that this one gets some upwind :)
Title: Re: Improve wireframe rendering
Post by: Ondra on 2017-10-17, 15:40:55
I know why this is happening - the pixel to world ratio used to "normalize" the width to 1px changes on grazing angles, because you see more of the grazing surface in one pixel. But you would need to compensate for this based on direction, which is currently not possible - the line width changes for all directions, even those not needing it.

So currently it works correctly for perpendicular lines, but not for those parallel with the perspective projection. Looking at the results, it will be probably best to change the way this works.
Title: Re: Improve wireframe rendering
Post by: romullus on 2017-10-17, 16:40:38
Would it be possible to compute anisotropic pixels depending on angle, or is it too complex? If not possible, then yeah, i would prefer constant width parallel lines at the expense of perpendicular ones, as often those are not visible at grazing angles anyway.

Or maybe we need a swith - favor parallel vs perpendicular? Just kidding :]
Title: Re: Improve wireframe rendering
Post by: burnin on 2017-12-22, 15:43:36
No changes still.
Any plans?
Title: Re: Improve wireframe rendering
Post by: Ondra on 2017-12-22, 17:54:16
nothing changed so far
Title: Re: Improve wireframe rendering
Post by: maru on 2020-03-09, 13:14:12
Logged.

(Internal ID=475481973)