Cycles - Mist #31860

Closed
opened 2012-06-18 07:38:04 +02:00 by Agustin benavidez · 18 comments

%%%Hi Blender developers, this time I put available a patch that i have tired to finish it today but didn't quite yet, it is usable and stable i think, but lefts improvements in the way it calculate the mist volumes and add a couple of extra features to make it more interesting.

I put this patch here to keep track of it and for anyone that may need render proper mist, this could be useful for them.
I will try to upload a new version and finished in the next days.

Features:

  • 3 Types of fallow Fallof.
  • Height, min/max distances, intensity.
  • Fake Horizon gradient to blend mist better with the background
  • Anti-Aliased Mist pass output to the compositor, optional exclude from final render buffer.
  • Support for Transparent BSDF (no more transparent alpha leaves parts casting mist! :) )
  • Support for glossy and glass BSDF (you can see the mist in the reflections and trough a glass )
  • Viewport preview / color adjustable.

Thanks
Agus

%%%

%%%Hi Blender developers, this time I put available a patch that i have tired to finish it today but didn't quite yet, it is usable and stable i think, but lefts improvements in the way it calculate the mist volumes and add a couple of extra features to make it more interesting. I put this patch here to keep track of it and for anyone that may need render proper mist, this could be useful for them. I will try to upload a new version and finished in the next days. Features: - 3 Types of fallow Fallof. - Height, min/max distances, intensity. - Fake Horizon gradient to blend mist better with the background - Anti-Aliased Mist pass output to the compositor, optional exclude from final render buffer. - Support for Transparent BSDF (no more transparent alpha leaves parts casting mist! :) ) - Support for glossy and glass BSDF (you can see the mist in the reflections and trough a glass ) - Viewport preview / color adjustable. Thanks Agus %%%

Changed status to: 'Open'

Changed status to: 'Open'
%%%Here is also a blend file and a screen shot of it to test it: https://dl.dropbox.com/u/65979653/BlenderComunityShare/blends/Cycles-Mist_test.rar http://www.pasteall.org/pic/show.php?id=33384 %%%

%%%This patch breaks GPU compiling:

d:\blender_dev\code\trunk\intern\cycles\kernel\kernel_accumulate.h(234): error:
class "KernelGlobals" has no member "__data"

d:\blender_dev\code\trunk\intern\cycles\kernel\kernel_accumulate.h(257): error:
class "float3" has no member "mist"

d:\blender_dev\code\trunk\intern\cycles\kernel\kernel_accumulate.h(265): error:
class "KernelGlobals" has no member "__data"

d:\blender_dev\code\trunk\intern\cycles\kernel\kernel_accumulate.h(270): error:
class "float3" has no member "mist"

d:\blender_dev\code\trunk\intern\cycles\kernel\kernel_accumulate.h(303): error:
class "KernelGlobals" has no member "__data"

d:\blender_dev\code\trunk\intern\cycles\kernel\kernel_accumulate.h(304): error:
class "float3" has no member "mist"

d:\blender_dev\code\trunk\intern\cycles\kernel\kernel_accumulate.h(310): error:
class "float3" has no member "mist"
%%%

%%%This patch breaks GPU compiling: d:\blender_dev\code\trunk\intern\cycles\kernel\kernel_accumulate.h(234): error: class "KernelGlobals" has no member "__data" d:\blender_dev\code\trunk\intern\cycles\kernel\kernel_accumulate.h(257): error: class "float3" has no member "mist" d:\blender_dev\code\trunk\intern\cycles\kernel\kernel_accumulate.h(265): error: class "KernelGlobals" has no member "__data" d:\blender_dev\code\trunk\intern\cycles\kernel\kernel_accumulate.h(270): error: class "float3" has no member "mist" d:\blender_dev\code\trunk\intern\cycles\kernel\kernel_accumulate.h(303): error: class "KernelGlobals" has no member "__data" d:\blender_dev\code\trunk\intern\cycles\kernel\kernel_accumulate.h(304): error: class "float3" has no member "mist" d:\blender_dev\code\trunk\intern\cycles\kernel\kernel_accumulate.h(310): error: class "float3" has no member "mist" %%%

%%%Hi Thomas, thank you for testing it!
I manage to grab some time and give a try to fix it (can't test, don't have proper Cuda card). Could I try to compile to see the errors at least? even if i only have a 1.1 Cuda capable device? I am lazy to try out without being sure.

I also improve the horizon haze, now it is based on the angle relative to the horizon, and its fallof is a cubic decay, as well the height influence, looks/works MUCH better now.

I Attached the new patch in attachments (CyclesMist_v0.85.patch)

Pics:
http://www.pasteall.org/pic/show.php?id=33443
http://www.pasteall.org/pic/show.php?id=33444

%%%

%%%Hi Thomas, thank you for testing it! I manage to grab some time and give a try to fix it (can't test, don't have proper Cuda card). Could I try to compile to see the errors at least? even if i only have a 1.1 Cuda capable device? I am lazy to try out without being sure. > I also improve the horizon haze, now it is based on the angle relative to the horizon, and its fallof is a cubic decay, as well the height influence, looks/works MUCH better now. I Attached the new patch in attachments (CyclesMist_v0.85.patch) Pics: http://www.pasteall.org/pic/show.php?id=33443 http://www.pasteall.org/pic/show.php?id=33444 %%%

%%%Hi Augustin, there are some errors left:
Compiling CUDA kernel ...
/daten/branches/bratwurst/build/linux/bin/2.63/scripts/addons/cycles/kernel/kernel_accumulate.h(260): error: class "float3" has no member "mist"

/daten/branches/bratwurst/build/linux/bin/2.63/scripts/addons/cycles/kernel/kernel_accumulate.h(261): error: class "float3" has no member "mist"

/daten/branches/bratwurst/build/linux/bin/2.63/scripts/addons/cycles/kernel/kernel_accumulate.h(262): error: class "float3" has no member "mist"

/daten/branches/bratwurst/build/linux/bin/2.63/scripts/addons/cycles/kernel/kernel_accumulate.h(280): error: class "float3" has no member "mist"

/daten/branches/bratwurst/build/linux/bin/2.63/scripts/addons/cycles/kernel/kernel_accumulate.h(284): error: class "float3" has no member "mist"

/daten/branches/bratwurst/build/linux/bin/2.63/scripts/addons/cycles/kernel/kernel_accumulate.h(292): error: class "float3" has no member "mist"

/daten/branches/bratwurst/build/linux/bin/2.63/scripts/addons/cycles/kernel/kernel_accumulate.h(298): error: class "float3" has no member "mist"

7 errors detected in the compilation of "/tmp/tmpxft_0000163e_00000000-4_kernel.cpp4.ii".

I think it make no sense with a cuda 1.1 card because of not working render passes < cuda 2.0.

Thank you for that patch, cheers, mib2berlin
%%%

%%%Hi Augustin, there are some errors left: Compiling CUDA kernel ... /daten/branches/bratwurst/build/linux/bin/2.63/scripts/addons/cycles/kernel/kernel_accumulate.h(260): error: class "float3" has no member "mist" /daten/branches/bratwurst/build/linux/bin/2.63/scripts/addons/cycles/kernel/kernel_accumulate.h(261): error: class "float3" has no member "mist" /daten/branches/bratwurst/build/linux/bin/2.63/scripts/addons/cycles/kernel/kernel_accumulate.h(262): error: class "float3" has no member "mist" /daten/branches/bratwurst/build/linux/bin/2.63/scripts/addons/cycles/kernel/kernel_accumulate.h(280): error: class "float3" has no member "mist" /daten/branches/bratwurst/build/linux/bin/2.63/scripts/addons/cycles/kernel/kernel_accumulate.h(284): error: class "float3" has no member "mist" /daten/branches/bratwurst/build/linux/bin/2.63/scripts/addons/cycles/kernel/kernel_accumulate.h(292): error: class "float3" has no member "mist" /daten/branches/bratwurst/build/linux/bin/2.63/scripts/addons/cycles/kernel/kernel_accumulate.h(298): error: class "float3" has no member "mist" 7 errors detected in the compilation of "/tmp/tmpxft_0000163e_00000000-4_kernel.cpp4.ii". I think it make no sense with a cuda 1.1 card because of not working render passes < cuda 2.0. Thank you for that patch, cheers, mib2berlin %%%

%%%I will take a look at it later, maybe I can fix it. %%%

%%%I will take a look at it later, maybe I can fix it. %%%

%%%Attached CyclesMist_v0.86.patch

  • UI code cleanup and renamed panel to Mist
  • Removed an unneeded define Mist from kernel_accumulate.h, already defined in kernel_types.h

Some general workflow feedback:

  • Although it might be nice to be able to exclude Mist from the combined pass, this is not how it should be done. It would also make sense to exclude AO, or Shadow or whatever then. We should not break the consistency here. So -1 for this "Pass Only" option.
    I would also treat it like AO, it has a checkbox to enable AO in the panel header, and even if that is disabled you can get an AO pass. Same should apply to Mist imo.

What do you think?
Regards,
Thomas%%%

%%%Attached CyclesMist_v0.86.patch - UI code cleanup and renamed panel to Mist - Removed an unneeded define __Mist__ from kernel_accumulate.h, already defined in kernel_types.h Some general workflow feedback: * Although it might be nice to be able to exclude Mist from the combined pass, this is not how it should be done. It would also make sense to exclude AO, or Shadow or whatever then. We should not break the consistency here. So -1 for this "Pass Only" option. I would also treat it like AO, it has a checkbox to enable AO in the panel header, and even if that is disabled you can get an AO pass. Same should apply to Mist imo. What do you think? Regards, Thomas%%%

%%%So basically, having the checkbox disabled in the world panel, but enabling the pass, is your "Pass only" :) (Again, look at AO for reference) %%%

%%%So basically, having the checkbox disabled in the world panel, but enabling the pass, is your "Pass only" :) (Again, look at AO for reference) %%%

%%%Thank you Thomas for your support, it really helps
Yes thats was a todo, i just found handy put that option there while modifying the addon, but yes, it should be a "Mist" checkbox, so it will enable in the final render, and the mist pass checkbox in render layers should enable the pass buffer.
Regarding the atmosphere panel name it was like that because i was thinking to include more atmospheric effects, not only mist, but i agree that while i am not including more options it can be named mist..
Thanks for 0.86, does it compiles on the GPU?
%%%

%%%Thank you Thomas for your support, it really helps Yes thats was a todo, i just found handy put that option there while modifying the addon, but yes, it should be a "Mist" checkbox, so it will enable in the final render, and the mist pass checkbox in render layers should enable the pass buffer. Regarding the atmosphere panel name it was like that because i was thinking to include more atmospheric effects, not only mist, but i agree that while i am not including more options it can be named mist.. Thanks for 0.86, does it compiles on the GPU? %%%
Member

%%%0.86 causes the following errors on Geforce GTX 470 + CUDA Toolkit 4.1:

Compiling CUDA kernel ...
nvcc warning : Option '--opencc-options (-Xopencc)' is obsolete and ignored, when targeting compute_20, sm_20, or higher
/home/irie/build/blender2.6/cmake/bin/2.63/scripts/addons/cycles/kernel/kernel_accumulate.h(298): error: no operator "- [ ]" matches these operands

          operand types are: float4 [ int ]

/home/irie/build/blender2.6/cmake/bin/2.63/scripts/addons/cycles/kernel/kernel_passes.h(131): error: no operator "- [ ]" matches these operands

          operand types are: float4 [ int ]

2 errors detected in the compilation of "/tmp/tmpxft_00005b8b_00000000-6_kernel.cpp1.ii".

Anyway, I think the render results don't look realistic because the mist doesn't cast/receive shadows. Cannot Tyndall scattering be simulated?
%%%

%%%0.86 causes the following errors on Geforce GTX 470 + CUDA Toolkit 4.1: Compiling CUDA kernel ... nvcc warning : Option '--opencc-options (-Xopencc)' is obsolete and ignored, when targeting compute_20, sm_20, or higher /home/irie/build/blender2.6/cmake/bin/2.63/scripts/addons/cycles/kernel/kernel_accumulate.h(298): error: no operator "- [ ]" matches these operands ``` operand types are: float4 [ int ] ``` /home/irie/build/blender2.6/cmake/bin/2.63/scripts/addons/cycles/kernel/kernel_passes.h(131): error: no operator "- [ ]" matches these operands ``` operand types are: float4 [ int ] ``` 2 errors detected in the compilation of "/tmp/tmpxft_00005b8b_00000000-6_kernel.cpp1.ii". Anyway, I think the render results don't look realistic because the mist doesn't cast/receive shadows. Cannot Tyndall scattering be simulated? %%%

%%%I attached a 0.87 patch version, wich may fix the issues you got Shinsuke Irie.
Please test it if it works
Regarding the volume shadow, this is a classic mist effect, no scattering effects, the idea is to render long distance mist in no time. for realistic volume shadows you have to wait to proper volume render support.%%%

%%%I attached a 0.87 patch version, wich may fix the issues you got Shinsuke Irie. Please test it if it works Regarding the volume shadow, this is a classic mist effect, no scattering effects, the idea is to render long distance mist in no time. for realistic volume shadows you have to wait to proper volume render support.%%%
Member

%%%v0.87 works for me.
%%%

%%%v0.87 works for me. %%%

%%%This fast/cheap mist is an excellent addition to Cycles even when we get true volumetrics in Cycles this feature will still be welcome and often used.

I nice option would be to enable the mist in all viewing directions.

At the moment the mist seem to only affect the horizon and when looking downward. When the camera is looking upward there is no mist. I am sure this is a feature to blend the fog into the sky but it does cause problems in certain situations(Looking up at a cliff in my case). Perhaps if the "Horizon Haze" option could be set to 180 degrees so that it covers all the viewing angles(looking upwards too), or perhaps a checkbox to disable this behavour would be a good option to have.
%%%

%%%This fast/cheap mist is an excellent addition to Cycles even when we get true volumetrics in Cycles this feature will still be welcome and often used. I nice option would be to enable the mist in all viewing directions. At the moment the mist seem to only affect the horizon and when looking downward. When the camera is looking upward there is no mist. I am sure this is a feature to blend the fog into the sky but it does cause problems in certain situations(Looking up at a cliff in my case). Perhaps if the "Horizon Haze" option could be set to 180 degrees so that it covers all the viewing angles(looking upwards too), or perhaps a checkbox to disable this behavour would be a good option to have. %%%

%%%I've investigated this patch, but finally don't think it's a good idea to add a custom mist effect to the renderer now. This should wait for volumetrics, if we are adding one particular effect now, it will be difficult to keep it working after we add volumetrics, it adds quite a bit of complexity to the path tracer.%%%

%%%I've investigated this patch, but finally don't think it's a good idea to add a custom mist effect to the renderer now. This should wait for volumetrics, if we are adding one particular effect now, it will be difficult to keep it working after we add volumetrics, it adds quite a bit of complexity to the path tracer.%%%

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Added subscriber: @juancarlosgzrz

Added subscriber: @juancarlosgzrz

What happened with this?

What happened with this?

Read Brechts response above, we decided not to include this. Instead you can use Volume rendering now.

Read Brechts response above, we decided not to include this. Instead you can use Volume rendering now.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#31860
No description provided.