Logo by yv3 - 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: Follow us on Twitter
 
*
Welcome, Guest. Please login or register. April 19, 2024, 05:19:48 PM


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: Problem with aux. lights in windows-version (only)  (Read 3373 times)
0 Members and 1 Guest are viewing this topic.
SaMMy
Alien
***
Posts: 21


« on: May 08, 2010, 06:51:27 AM »

I am worry that there is a problem with the random aux. lights in the win-version.

I've tested the "tglad - scale 2 - cloured lights" file:

Linux (Ubuntu, Virtual Box): No Problems

WinXP (32bit), 2GB Ram, Athlon64-X2  4200+: When I set the number of aux. lights to 5 or more the same testfile renders a total different result: the Mandelbox gets totaly white.

Only when i set aux.lights to 0 - 4 (and the 4 predefined lights are enabled) the mandelbox looks ok.
If I disable the predefined lights and/or increase the number of aux.lights, the result is the same, a white Mandelbox.

(Sorry for english)

---------------
HEITER WEITER,

SaM
« Last Edit: May 10, 2010, 07:13:39 PM by SaMMy » Logged
mephisto69
Guest
« Reply #1 on: May 09, 2010, 12:44:27 AM »

I also have this problem, running Win7x64 - either that, or I'm not doing something right??  Hopefully the User guide can get updated so we have a little more idea of how the new parameters are supposed to function...
Logged
SaMMy
Alien
***
Posts: 21


« Reply #2 on: May 09, 2010, 01:35:59 AM »

Here are the 2 pics. Absolut same parameters from "tglad - scale 2 - coloured lights" (only set the aux-lights to 6):

Linux:




Same parameters, winXP32bit:




I've found something in the program-output what can be acountable for the problem (?). The coordinates for light-positions are not the same :

Here are the output from linux:

3: Number of lights = 6
Light no. 0: x=-4,612079, y=-1,626779, z=-0,812399, distance=0,000319
Light no. 1: x=0,890161, y=-3,584340, z=-6,059460, distance=0,017740
Light no. 2: x=-0,845340, y=-2,386559, z=3,520200, distance=0,000000
Light no. 3: x=2,136060, y=2,688840, z=4,807801, distance=0,008595
Light no. 4: x=-5,934660, y=3,267241, z=1,146240, distance=0,000000
Light no. 5: x=6,120000, y=2,231221, z=-4,945079, distance=0,039788


And here the output for winXP:

3: Number of lights = 6
Light no. 0: x=-59,445180, y=-58,968600, z=-59,065440, distance=30,266583
Light no. 1: x=-58,992480, y=-58,617480, z=-58,405560, distance=29,989387
Light no. 2: x=-58,805640, y=-58,585500, z=-59,187060, distance=30,095997
Light no. 3: x=-58,782360, y=-58,588380, z=-58,567680, distance=29,974514
Light no. 4: x=-58,212360, y=-58,533060, z=-59,025120, distance=29,943263
Light no. 5: x=-58,301460, y=-58,424340, z=-59,739900, distance=30,076629


Completly different.
« Last Edit: May 09, 2010, 01:39:07 AM by SaMMy » Logged
mephisto69
Guest
« Reply #3 on: May 09, 2010, 02:50:37 AM »

Yup, that's exactly what I get also.
Logged
knighty
Fractal Iambus
***
Posts: 819


« Reply #4 on: May 09, 2010, 11:21:43 AM »

Maybe I did something wrong with the source code or the source code published doesn't correspond to the latest linux version. The only modification I did was replacing exp10(x) function with pow(10,x). I'll try to see where is the problem. Perhaps the pseudo random function is different in win32.
Logged
Buddhi
Fractal Iambus
***
Posts: 895



WWW
« Reply #5 on: May 10, 2010, 11:04:59 PM »

Thank you for bug report. I will check it tomorrow
Logged

Buddhi
Fractal Iambus
***
Posts: 895



WWW
« Reply #6 on: May 11, 2010, 09:00:36 PM »

I checked this on my Windows also and I confirmed that there is probrem with random number generator. In my program I used rand() function from stdlib.h. There is difference in implementation of this function between Windows and Linux. In Linux rand() generates values up to 2147483647 but in Windows only up to 32767 (Windows still has some 16-bit parts cheesy ). There are two ways to solve this

1. in stdlib.h there is definition:
Code:
/* The largest number rand will return.  */
#define RAND_MAX 32767
Please try to change this to 2147483647.

2. In common_math.cpp there is definition of function Random(int max)
Code:
int Random(int max)
{
return rand() % (max + 1);
}
It could be changed to:
Code:
int Random(int max)
{
return (rand()+rand()*32768) % (max + 1);
}

Knighty, if you can please check this. If it will works I will correct this in program and send you updated source with other fixes (I solved problem with loading settings files created in older versions of Mandelbulber).
Logged

knighty
Fractal Iambus
***
Posts: 819


« Reply #7 on: May 11, 2010, 09:10:32 PM »

I will, ASAP smiley
Logged
mephisto69
Guest
« Reply #8 on: May 11, 2010, 10:18:43 PM »

Thanks guys - I'd really like to try out the new lighting parameters!
Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #9 on: May 11, 2010, 10:43:41 PM »

I checked this on my Windows also and I confirmed that there is probrem with random number generator. In my program I used rand() function from stdlib.h. There is difference in implementation of this function between Windows and Linux. In Linux rand() generates values up to 2147483647 but in Windows only up to 32767 (Windows still has some 16-bit parts cheesy ). There are two ways to solve this

1. in stdlib.h there is definition:
Code:
/* The largest number rand will return.  */
#define RAND_MAX 32767
Please try to change this to 2147483647.

2. In common_math.cpp there is definition of function Random(int max)
Code:
int Random(int max)
{
return rand() % (max + 1);
}
It could be changed to:
Code:
int Random(int max)
{
return (rand()+rand()*32768) % (max + 1);
}

Knighty, if you can please check this. If it will works I will correct this in program and send you updated source with other fixes (I solved problem with loading settings files created in older versions of Mandelbulber).



Maybe too late to change it now, given that it would affect some current parameter files, but I'd recommend implimenting your own random() using a version of the "Mersenne Twister" instead of using rand() because rand() is statistically not very random smiley
When I changed my old (very old) IFS code (included in a private version of MMFrac) switching to the Mersenne Twister instead of the other randoms I tried made the chaos game method siginificantly better i.e. much more even rendering than any other random method (when the probabilities where set at the correct values for even rendering).
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
hobold
Fractal Bachius
*
Posts: 573


« Reply #10 on: May 12, 2010, 01:07:02 AM »

I second the advice. Randomness should not be left to chance. smiley

Stdlib's rand() is very bad, random() is newer and often better, but the quality of its implementation is platform dependent (i.e. no guarantee that it is actually better than rand()). The Mersenne Twister algorithm has a very good reputation for simulations. It is efficient and delivers good randomness even if you need large quantities of random bits.

For a multi-platform application, implementing your own custom random number generator has the additional benefit that it produces consistent results across all different machines (well, with a bit of care).
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
fractint for windows problem? Help & Support tomot 1 1707 Last post April 25, 2011, 12:43:07 AM
by wmauzey
Buddha++, first windows version \o/ Announcements & News ker2x 5 2284 Last post April 01, 2011, 10:14:09 AM
by ker2x
Saturn Windows 7 Problem Announcements & News element90 0 1181 Last post March 13, 2012, 04:48:28 PM
by element90
Version 1.8 Display problem with custom DPI setting bug reporting 0Encrypted0 1 1640 Last post July 21, 2012, 08:33:11 PM
by Jesse

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.155 seconds with 25 queries. (Pretty URLs adds 0.008s, 2q)