|
|
kurtz le pirate <kur### [at] freefr> wrote:
> Here, the result of the transcoding from MathMod to POVRay.
> (see discussion in p.a-u).
That came out great - and the stone texture is beautiful :)
(At some point, if you aren't using your computer for anything for a while, an
HDR environment and SSLT in the stone texture would probably be fantastic.)
I think that I'd like to see the functions you used.
Normally when I translate between other forms and SDL, I write my SDL on the
top, and leave the original code as a long comment on the bottom. Sometimes
I'll even just interleave the SDL with the original commented-out code so that I
can see what I'm doing line-pair by line-pair.
Great work, and I'm glad it all got straightened out. :)
Thanks Tor, as always!
- BW
Post a reply to this message
|
|
|
|
On 09/12/2024 17:45, Bald Eagle wrote:
>
> That came out great - and the stone texture is beautiful :)
It's just the 'T_Stone20'
> (At some point, if you aren't using your computer for anything for a while, an
> HDR environment and SSLT in the stone texture would probably be fantastic.)
hum... SSLT is beyond my knowledge. I've never played with this option.
> I think that I'd like to see the functions you used.
Text file attached here. Only the interesting part with functions.
No prettyprint, sorry.
> Great work, and I'm glad it all got straightened out. :)
> Thanks Tor, as always!
Yes, Tor always adds his little grain of salt which helps a lot.
--
kurtz le pirate
compagnie de la banquise
Post a reply to this message
Attachments:
Download 'mathmod_vase.txt' (5 KB)
|
|
|
|
On 20/12/2024 19:19, Kenneth wrote:
> Wow, that is a beauty. And a really interesting use of isosurface functions.
>
> I tried to follow your recent post about the function re-writing from MathMod,
> but got hopelessly lost :-( Very sophisticated! I need to re-read it...over and
> over again, until it sinks into my poor brain...
>
But no, it's not that difficult.
You just need to know a few tricks and have lot of patience...
* Replace the rise to power '^' by pow(a,b) or write explicitly a*a*a...
* A function is defined by its name and parameters.
The current parameters (x,y,z) may not be written.
#declare foo = function {...} is the same thing that
#declare foo = function(x,y,z) {...}
* Check the number of parameters required by the function.
N required -> N passed and N passed -> N required.
* Mathmod often uses the 't' parameter. In the vast majority of cases,
this parameter can be omitted. 't' is used for animation and/or
morphing.
* Matmod lets you use 'if' in functions. POVRay doesn't.
You have to replace it with a 'select()'. See TOK's more detailed
explanations.
* Remember also that POV compares to zero in the 'select()'.
In Matmod this is not always the case.
* In Matmod, declaration is sequential and a function can be redefined.
In fact, the same 'function name' can be used several times.
In POV, this is forbidden (and so much the better!).
* Don't forget the constants and the domains
Sample :
"Animated Bone Cage model by Abderrahman Taha 12/11/2020"
"P_Skeletal0=-y-z+(51/100)*(-x*y+y*z+z*x)+12/10"
-> Add '#declare' at the beginning, remove the quotation marks, add
'function {' after the equal sign and at the end of the line.
#declare P_Skeletal0 = function{ -y-z+(51/100)*(-x*y+y*z+z*x)+12/10 }
Then
"isoTransform=if((x-pi)*(x-pi)<(13),P_Skeletal(x,y-4*t,z-20*t,t),(1))+exp((x-pi)*(x-pi)-9)"
Which can be rewritten as :
"isoTransform = if (
(x-pi)*(x-pi)<(13),
P_Skeletal(x,y-4*t,z-20*t,t),
(1)
)
+exp((x-pi)*(x-pi)-9)"
We replace the 'if()' with a 'select()', paying attention to the
condition, which in this case is not relative to (zero) but to (13).
Resulting in :
#declare isoTransform = function {
select (
(x-pi)*(x-pi)-13, // A : condition with respect to 0
P_Skeletal(x,y,z) // If A < 0
1 // Else (A >=0)
)
+exp((x-pi)*(x-pi)-9)
}
Note the deletion of the 't' parameter.
The hardest part is still adjusting the isosurface parameters:
contained_by, threshold, accuracy, max_gradient, ...
All this also works for the parametric part and the
parametric { } POV's object.
Have fun !!
--
kurtz le pirate
compagnie de la banquise
Post a reply to this message
|
|