Logo by Pauldelbrot - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Visit us on facebook
 
*
Welcome, Guest. Please login or register. April 25, 2024, 12:34:55 AM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Hard shadows in M3D  (Read 2874 times)
Description: How to optimize calculation time??
0 Members and 1 Guest are viewing this topic.
bib
Global Moderator
Fractal Senior
******
Posts: 2070


At the borders...


100008697663777 @bib993
WWW
« on: October 31, 2010, 08:23:40 AM »

I find sometimes hard shadows very long to calculate, almost as long as the main rendering, especially since the 1.6 version where main rendering has been notably enhanced. I noticed that the light angle has a strong influence on calc time: the more you want elongated shadows, the longer it will take. Of course the number of light sources for which HS are calculated as well.

Is there any tip to accelerate hard shadows without changing too much the light angles? Do the parameters in the Calculation tab in the main window have an influence on HS calc time?

Other question : I'm not sure about the usage of the "Set light diff-function to Cos", what does it do?
Logged

Between order and disorder reigns a delicious moment. (Paul Valéry)
hobold
Fractal Bachius
*
Posts: 573


« Reply #1 on: October 31, 2010, 09:34:02 AM »

I don't know the exact method that Jesse uses to compute hard shadows. I would guess that it's done the usual way: you trace a ray from the current surface point to the light source, and check if it hits something other than the light source. If the path between surface and light source is unobstructed, then the point is illuminated by the light source, otherwise it's in shadow.

That means for dramatic elongated shadows, most shadow feeler rays will graze across the fractal surface for long distances. In close proximity to the surface, however, step size is small (proportional to distance to the surface).

Or another way to explain it: elongated shadows means that the shadow outline is an enlarged outline of the fractal. So to be accurate, the computer has to spend quite a bit of effort to compute this outline in great detail. Even if it retains just one bit (in shadow/in light) of that information.


Grazing shadows are a worst case for DE based ray marching, unfortunately. There are several other algorithms for generating shadows, but they all have their own problems and inaccuracies.
Logged
Jesse
Download Section
Fractal Schemer
*
Posts: 1013


« Reply #2 on: October 31, 2010, 11:34:12 AM »

Hobold explained it very well, i have tried to make some speedups because of the fact that the rays
from the surface are parallel or getting closer towards the lightsource, so you can use some facts of
the previous calculated ray on the current one.
But that unfortunately also fails when the rays are following nearby structures.

I could only reduce the maximum length of the Rays beeing calculated, what can lead to artifacts of
course.


Missed the second question:

The "Set light diff-function to Cos" makes exactly what it says, you have in the light adjustments tab
the "Diffuse:" parameter with 4 choices, if it would be set to one of the lower 2 choices the edges
where the hard shadow will start, for example on a marble, could have a step in the ligh curve what
looks bad.

So if this option in the HS function is set, the light function from what the HS are calculated will be set
automatically to this diffuse function.
« Last Edit: October 31, 2010, 11:44:13 AM by Jesse » Logged
Jesse
Download Section
Fractal Schemer
*
Posts: 1013


« Reply #3 on: November 08, 2010, 11:15:59 PM »

Just found a kind of bug with the hard shadows: applied the raystep multiplier twice, that explains the long time especially for low values of the multiplier!!
So you were absolutely right bib  smiley
Logged
MarkJayBee
Fractal Fertilizer
*****
Posts: 364



Markjaybee Fractal Mark_Jay_Bee
WWW
« Reply #4 on: November 17, 2010, 05:16:34 PM »

@Jesse,
Bearing in mind that I am in no way a programmer, would it be practical
in some future version of M3D to have a variable 'soft shadow' option?
By this I mean the ability to simulate, say, an overcast day where the
shadow edges are fairly undefined, but allowing control of the level of
edge 'softness'?
Of course, I could be asking too much, as the amount of work which
has gone into refining the current hard shadows function beggars belief!
Still, I live in hope.... cheesy
Logged

If at first you don't succeed, destroy all evidence that you ever tried in the first place.

http://markjaybeefractal.com/
http://mjb-graphics.co.uk/
http://deviantart.com/markjaybee/
bib
Global Moderator
Fractal Senior
******
Posts: 2070


At the borders...


100008697663777 @bib993
WWW
« Reply #5 on: November 17, 2010, 05:36:24 PM »

@Markjaybee, to modify the edge softness, try to play with the 'Diffuse' parameter
Logged

Between order and disorder reigns a delicious moment. (Paul Valéry)
Jesse
Download Section
Fractal Schemer
*
Posts: 1013


« Reply #6 on: November 17, 2010, 10:13:35 PM »

If you only want to change the direct light amount around edges then you can do what bib said... the diffuse light function gives some options for different light amounts depending on the light angle on the surface.

But i guess you want also some soft shadows from objects falling on other surfaces, what is not that easy.
Was already thinking of modifying the ambient shadows to give different weights for the specific angles with respect to the light positions...

Another one is to use lightmaps for ambient, and maybe putting in the light sources.  Sounds not bad, but i am currently stuck with to much other thingys.   undecided
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Hard shadows create more noise in 1.697n? Mandelbulb 3d « 1 2 » Madman 18 5102 Last post May 23, 2011, 11:02:49 PM
by Madman
Hard Shadows & Reflections Mandelbulb 3d MindsEye 5 1567 Last post February 16, 2012, 07:56:21 PM
by MindsEye
is there a limitation for hard shadow casting distance? Mandelbulb 3d taurus 3 1769 Last post October 07, 2012, 04:53:29 PM
by Alef
Hard shadows on concave surface with positional light v1.7 bug reporting brandpeter 0 1739 Last post January 14, 2013, 10:59:19 PM
by brandpeter
hard shadows Images Showcase (Rate My Fractal) thom 2 919 Last post July 17, 2015, 04:43:22 AM
by thom

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.157 seconds with 25 queries. (Pretty URLs adds 0.011s, 2q)