From 9d2fc97827e2b94eb436081185108db9043ae54e Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Mon, 20 Oct 2008 07:08:06 +0000 Subject: New volume rendering feature: Light Cache This was a bit complicated to do, but is working pretty well now, and can make shading significantly faster to render. This option pre-calculates self-shading information into a 3d voxel grid before rendering, then uses and interpolates that data during the main rendering phase, rather than calculating shading for each sample. It's an approximation and isn't as accurate as getting the lighting directly, but in many cases it looks very similar and renders much faster. The voxel grid covers the object's 3D screen-aligned bounding box so this may not be that useful for large volume regions like a big range of cloud cover, since you'll need a lot of resolution. The render time speaks for itself here: http://mke3.net/blender/devel/rendering/volumetrics/vol_light_cache_interpolation.jpg The resolution is set in the volume panel - it's the resolution of one edge of the voxel grid. Keep in mind that the higher the resolution, the more memory needed, like in fluid sim. The memory requirements increase with the cube of the edge resolution so be careful. I might try and add a little memory calculator thing like fluid sim has there later. The voxels are interpolated using trilinear interpolation - here's a comparison image I made during testing: http://mke3.net/blender/devel/rendering/volumetrics/vol_light_cache_compare.jpg There might still be a couple of little tweaks I can do to improve the visual quality, I'll see. --- source/blender/blenkernel/intern/material.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/blenkernel/intern/material.c') diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 3fcc76bf058..b47e4d2ebaa 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -173,6 +173,7 @@ void init_material(Material *ma) ma->vol_absorption = 1.0f; ma->vol_scattering = 1.0f; ma->vol_absorption_col[0] = ma->vol_absorption_col[1] = ma->vol_absorption_col[2] = 0.0f; + ma->vol_precache_resolution = 50; ma->mode= MA_TRACEBLE|MA_SHADBUF|MA_SHADOW|MA_RADIO|MA_RAYBIAS|MA_TANGENT_STR; -- cgit v1.2.3