Mustard2 / MustardSimplify

A scene simplifier for Blender to increase viewport performance
MIT License
54 stars 2 forks source link

Turn off Fast Normals during final rendering #4

Closed Art4DD closed 1 year ago

Art4DD commented 1 year ago

Hi. Is it possible to make a checkbox that was responsible for enabling/disabling Fast Normals during rendering? Or there may be an alert when we run the render, then a dialog box appears about disabling Fast Normals.

Standard normal maps look better, so Fast Normals should be disabled in the final rendering.

If nothing can be done, then it's okay. But if you can turn off Fast Normals automatically when you start the render, then working with eevee will become more convenient.

Mustard2 commented 1 year ago

Hi!

This should be now available in #3 . :)

Again, this is scheduled to be closed when the merge request is closed. Feel free to re-open the issue if you find any problem here.

Mustard2 commented 1 year ago

Don't know if it's worthy to add another option to turn on Eevee Fast Normals again when the render is finished. What do you think?

Art4DD commented 1 year ago

It looks like Fast Normals are not disabled when rendering. I downloaded the version that came out 5 minutes ago and I rendered (Render Image F12) two frames with fast normals on and off. The frames are different.

Mustard2 commented 1 year ago

For me it does, or at least I see that before the rendering, the normal nodes are converted back to standard normals. Can you check what happens to the normal nodes in your file when you click on render when fast normals is enabled?

Also I fixed a bug just now, maybe it's that?

Art4DD commented 1 year ago

Can you check what happens to the normal nodes in your file when you click on render when fast normals is enabled?

Nothing. The nodes remain green.

Also I fixed a bug just now, maybe it's that?

No.

I can record a video later, maybe it will help. I use blender "version: 3.6.1, branch: blender-v3.6-release, commit date: 2023-07-17 12:50, hash: 8bda729ef4dc"

Mustard2 commented 1 year ago

Sure, thank you. Because in my case it works very well.

Some things I would check:

P.S. I switched to 'render_init' from 'render_pre' (done once at the beginning of the rendering, not for every frame).

Art4DD commented 1 year ago

enable advanced settings, do you see the new button near Eevee Fast Normals? It should be on (blue)

Yes

do you see the message in the console after starting the render?

There are no messages after the start of the render. The "debug mode" checkbox is enabled.

have you enabled python scripts in the Blender settings?

Of course, Auto Run Python Scripts is enabled.

Art4DD commented 1 year ago

The version from "25 minutes ago" crash blender immediately before/after rendering.

Art4DD commented 1 year ago

In a test light scene (one grid and one normal map) everything works. In my working heavy scene - no, there is a crash. In earlier versions, fast normals just didn't turn off.

Art4DD commented 1 year ago

Blender log file 300623_valeriyablend_pose21.crash.txt 300623_valeriyablend_pose21.crash2.txt 300623_valeriyablend_pose21.crash3.txt 300623_valeriyablend_pose21.crash4.txt

Mustard2 commented 1 year ago

Thank you very much for testing it!

I'll make some additional tests on other scenes then.

For the crashes: did you restart Blender after installing the new versions (uninstall old version, close Blender and then install the new one)? Because if 2 handlers are registered to do the same thing when the render starts, it will create memory issues.

Art4DD commented 1 year ago

For the crashes: did you restart Blender after installing the new versions (uninstall old version, close Blender and then install the new one)? Because if 2 handlers are registered to do the same thing when the render starts, it will create memory issues.

Yes. And just in case, I did everything again. And I get crashes. But sometimes the rendering goes without crashes and the normals also change. But 4/5 attempts I get crash. I'll try to download blender 3.6.2. maybe something will change.

UPD. I downloaded 3.6.2, nothing has changed, I get a crash.

Mustard2 commented 1 year ago

Maybe the crashes are due to the persistent decorator:

https://github.com/Mustard2/MustardSimplify/blob/6c2f6233cc05322046f547c556b09e0e377088e3/mustard_simplify.py#L158

You can try to remove only that line with @persistent and reinstall the addon. I'm trying on some scenes but I don't get the crash (yet). :(

Art4DD commented 1 year ago

You can try to remove only that line with @Persistent and reinstall the addon. I'm trying on some scenes but I don't get the crash (yet). :(

If I comment out line 158, then fast normals stop turning off before rendering.

Mustard2 commented 1 year ago

This seems like a bug of the Blender handlers, as I'm also getting random crashes. Not much I can do, except ask for help on Blender forums. :(

It doesn't seem to be as simple as I thought, thus I would pause this feature until I figure this out (post version 0.0.9). In the meanwhile I'll revert this change.

I'll keep you updated if there will be any news on this.

Mustard2 commented 1 year ago

As far as I understood, talking with other developers, there is a bug in Blender preventing this to work. I'll close this issue in the meanwhile. I'll re-open it if you new info are available.