A versatile ISL inconsistency was fixed, barring from tricks

Feature requests, bug reports and related discussion
Post Reply
4 posts • Page 1 of 1
User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

A versatile ISL inconsistency was fixed, barring from tricks

Post by CTZn » Sat Apr 09, 2016 10:35 pm

My terrain shader was using cyclical definitions references, and it used to work. Here, erosionCenter() is calling Noise() which uses absMult() (wich uses erosionCenter(), that's the catch) :

Code: Select all

def erosionCenter() real:
	paramErosionCenter() + Noise(paramErosionCenterScale(), paramErosionCenterStrength(), paramErosionCenterErodedNoise())

def absMult(real x) real:
let	x = if(paramCanyoning()==1) abs(x) - erosionCenter() else x - erosionCenter()
in	if(x<0.0&&paramCanyoning()==0)	x*x*-1.0
	else		x*x

def Noise(real noiseScale, real noiseStrength, int eroded) real:
let	Noise = baseNoise(paramScale()*noiseScale, -center())
*	noiseStrength/paramScale()/noiseScale
in	if(eroded==1) absMult(Noise) else Noise
Well, not anymore:

Code: Select all

Error while building scene: Error while loading phong material 'canyons': Tried to refer to a function defined later: Noise(float, float, int, opaque).
It was a kind of cool 'inconsistent' feature, more of a feature for me; is this wrong ?
obsolete asset

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Re: A versatile ISL inconsistency was fixed, barring from tr

Post by CTZn » Sat Apr 09, 2016 10:43 pm

If I should stop complaining because I'm a bad scripter you just tell me :D
obsolete asset

User avatar
OnoSendai
Developer
Posts: 6241
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Re: A versatile ISL inconsistency was fixed, barring from tr

Post by OnoSendai » Mon Apr 11, 2016 1:41 am

Sorry CTZn :)
Just reorder your functions so they are defined before use :)

EDIT: to be honest the reason that requirement was added is a bit lazy. The thing I am trying to avoid is circular definitions of functions, which are not allowed, and a simple way to enforce chat is to enforce a 'define before use' requirement.

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Re: A versatile ISL inconsistency was fixed, barring from tr

Post by CTZn » Mon Apr 11, 2016 11:18 am

Actually I tried to wrap my mind in order to break that circularity but iirc the results were not as satisfactory otherwise.

Bad scripting skills probably (too lazy to lay an analysis down) ! Now that was lazy from me also, because I meant to play with my shaders, not to rewrite them :lol: nvm
obsolete asset

Post Reply
4 posts • Page 1 of 1

Who is online

Users browsing this forum: No registered users and 42 guests