3Dickulus / FragM

Derived from https://github.com/Syntopia/Fragmentarium/
GNU General Public License v3.0
344 stars 30 forks source link

Undefined variable "time" when use #define USE_IQ_CLOUDS #194

Closed neozhaoliang closed 1 year ago

neozhaoliang commented 1 year ago

Hi, it looks like when using the "DE-Kn2cr11.frag" included in this repo, it has conflicts with the macro #define USE_IQ_CLOUDS, it reports the error "DE-Kn2cr11.frag(734): error C1503: undefined variable "time"". Is it because here the uniform time is commented out?

https://github.com/3Dickulus/Fragmentarium_Examples_Folder/blob/master/Include/DE-Kn2cr11.frag#L728

3Dickulus commented 1 year ago

"time" is a user optional variable, clouds were added to DE-Kn2cr11.frag without this consideration and had declared "time" internally causing conflicts in other frags.

You can find it in the menu Edit-> Insert Command->Special Uniforms

Simple solution is to put it in the user fragment before including Kn2cr11, the parts that use "time" in Kn2cr11 should be wrapped in #ifdef time ... #endif statements so that it doesn't cause an error if time is not declared... but they are not, will try to get that done, in the mean time...

...
uniform float time;
#include "DE-Kn2cr11.frag"
...

this works.

You could also uncomment the line in Kn2cr11 but that may cause problems in other user frags

neozhaoliang commented 1 year ago

Thank you! I have solved this problem with your help. I am working hard to make my frag files compatible with FragM, so that users can run them without manual modifications.

3Dickulus commented 1 year ago

the "time" variable with USE_IQ_CLOUDS is for making the clouds drift across the sky when animating the scene

neozhaoliang commented 1 year ago

Got that. Your replies are patient and very detailed. Thank you for all these. Another problem I'm having is, when I load a frag file to FragM which I have tuned the settings in Fragmentarium, the rendering quality looks very low: 图片 Is there a way that I can set the rendering quality in the preview window?

And for this file using the DE-Raytracer, when loaded to FragM, the colors are not shown correctly: 图片 Is it because the way some parameters working have changed?

3Dickulus commented 1 year ago

it looks like you have neglected to turn on frame accumulation "progressive rendering" so you are seeing a single frame single-frame accumulated-frames

3Dickulus commented 1 year ago

wrong-saturation with-saturation

neozhaoliang commented 1 year ago

Thank you so much! I have already solved these problems. It turns out that some of my settings were not very reasonable. I will update the settings in the repository later.