POV-Ray : Newsgroups : povray.binaries.images : brain bot progress rendering Server Time
20 May 2024 08:19:24 EDT (-0400)
  brain bot progress rendering (Message 11 to 19 of 19)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Mike Miller
Subject: Re: brain bot progress rendering
Date: 20 Jul 2023 19:20:00
Message: <web.64b9bfff41b179efb5177e91dabc9342@news.povray.org>
"Samuel B." <stb### [at] hotmailcom> wrote:
> "Mike Miller" <mil### [at] gmailcom> wrote:
> > "Samuel B." <stb### [at] hotmailcom> wrote:
> > > "Mike Miller" <mil### [at] gmailcom> wrote:
> > > > "Samuel B." <stb### [at] hotmailcom> wrote:
> > > > > "Mike Miller" <mil### [at] gmailcom> wrote:
> > > > > > Current modeling progress for a brain bot character. [...]
> > > > >
> > > > > It's looking really good!
> > > > >
> > > > > How are you modeling the brain?
> > > >
> > > > Thanks,
> > > > the brain is one continuous sphere_sweep/cubic_spline. [...] I exported the
> > > > spheres via .x3d and converted the file to POV syntax. [...]
> > >
> > > Ah, tracing the brain folds is a good solution, for sure.
> > >
> > > I know nothing about the .x3d file type, but it sounds like it somehow preserves
> > > lots of info including ordered point arrays? Or it can at least be converted to
> > > arrays?
>
> > Yes, you are correct. The .x3d holds all the naming and transform information of
> > the Blender types. As long as you stick with Blender primitives (blobs, spheres,
> > torus, cube, etc. the output file is simple to parse. I use it to export point
> > arrays for POV lathes, sweeps, prisms, 2D arrays. I wrote a converter that reads
> > the .x3d and writes POV syntax. Attached shows spheres renamed as 'pointData in
> > Blender... I convert the points into 'mixed array' to be used in a construction
> > loop.
> >
> > [...]
> >
> > In Blender, I array a sphere along a bezier path with the 'curve' modifier.
> > Collapsing the array and curve moodier to create a list of loose elements still
> > maintains a creation order. Prefect for lathes, sweeps, prisms, ect.
> > Miller
>
> That's some welcome information! Years ago, I made a Blender-to-.pov arrays
> script in Python to transport object orientation data to POV-Ray (for rigid body
> sims), but Blender's Python API changed over time, and the script stopped
> working :( The .x3d file type seems like a promising replacement, and might even
> be less work than finding the changed API calls all over again.
>
> > Currently working on some sci-fi tower forms.
>
> It's looking more interesting all the time.
>
> Sam


Thanks.
You're welcome to the VBcode or executables for .x3d to POV if you think you can
use them. One thing that I'm not converting are quaternion. I got hung-up on the
math converting back to euler. It hasn't been a big problem but it would be nice
to store rotation.
Mike.


Post a reply to this message

From: Samuel B 
Subject: Re: brain bot progress rendering
Date: 24 Jul 2023 19:25:00
Message: <web.64bf070d41b179eff8c47d526e741498@news.povray.org>
"Mike Miller" <mil### [at] gmailcom> wrote:
> Thanks.
> You're welcome to the VBcode or executables for .x3d to POV if you think you can
> use them. One thing that I'm not converting are quaternion. I got hung-up on the
> math converting back to euler. It hasn't been a big problem but it would be nice
> to store rotation.
> Mike.

I'll hit you up if I need it, but I haven't had a use for that recently. (Plus,
I don't work with VBcode, but maybe Code::Blocks probably supports it.)

Did the hang-up have to do with matrices? I know there's a way to derive
position, scale and rotation info from a single matrix.

I can't remember how I got rotational info out of Blender. This is the post I
made back when I was playing with a certain Blender-to-POV data exporter (I
can't believe it's already been 11 years!):
http://news.povray.org/povray.binaries.misc/thread/%3Cweb.5056a911b09798c46664708b0%40news.povray.org%3E/

Sam


Post a reply to this message

From: Samuel B 
Subject: Re: brain bot progress rendering
Date: 24 Jul 2023 19:55:00
Message: <web.64bf0e4241b179eff8c47d526e741498@news.povray.org>
"Samuel B." <stb### [at] hotmailcom> wrote:
> I can't remember how I got rotational info out of Blender.

Just looked at the Blender-Python code I used for getting rotational data. The
following seems to be what I went with:

  DX = math.degrees(obj.rotation_euler[0])
  DY = math.degrees(obj.rotation_euler[1])
  DZ = math.degrees(obj.rotation_euler[2])

It would appear that I relied on a built-in conversion function to get the
rotation for each axis. (I don't know if forgetting things is a blessing or a
curse :/)

Sam


Post a reply to this message

From: Mike Miller
Subject: Re: brain bot progress rendering
Date: 24 Jul 2023 22:00:00
Message: <web.64bf2c2c41b179efb5177e91dabc9342@news.povray.org>
"Samuel B." <stb### [at] hotmailcom> wrote:
> "Mike Miller" <mil### [at] gmailcom> wrote:
> > Thanks.
> > You're welcome to the VBcode or executables for .x3d to POV if you think you can
> > use them. One thing that I'm not converting are quaternion. I got hung-up on the
> > math converting back to euler. It hasn't been a big problem but it would be nice
> > to store rotation.
> > Mike.
>
> I'll hit you up if I need it, but I haven't had a use for that recently. (Plus,
> I don't work with VBcode, but maybe Code::Blocks probably supports it.)
>
> Did the hang-up have to do with matrices? I know there's a way to derive
> position, scale and rotation info from a single matrix.
>
> I can't remember how I got rotational info out of Blender. This is the post I
> made back when I was playing with a certain Blender-to-POV data exporter (I
> can't believe it's already been 11 years!):
>
http://news.povray.org/povray.binaries.misc/thread/%3Cweb.5056a911b09798c46664708b0%40news.povray.org%3E/
>
> Sam

Thanks for pointing me to that.
11 years goes fast...

I've been exporting Blender data through .x3D which does a nice job of
formatting, but the rotations are written as quaternion. I tried tweaking a
quaternion to euler script in VB but failed. Below is a .x3d transform block.
Mike

<Transform DEF="pointData_032_TRANSFORM"
   translation="9.958521 56.574299 -0.017123"
   scale="0.154254 0.154254 0.154254"
   rotation="0.000000 0.707107 0.707107 3.141593"
>


Post a reply to this message

From: Samuel B 
Subject: Re: brain bot progress rendering
Date: 25 Jul 2023 17:00:00
Message: <web.64c0371e41b179eff8c47d526e741498@news.povray.org>
"Mike Miller" <mil### [at] gmailcom> wrote:
> "Samuel B." <stb### [at] hotmailcom> wrote:
> > "Mike Miller" <mil### [at] gmailcom> wrote:
> > > [...] I got hung-up on the math converting back to euler. It hasn't been
> > > a big problem but it would be nice to store rotation. [...]
> >
> > Did the hang-up have to do with matrices? [...]
>
> [...]
> I've been exporting Blender data through .x3D which does a nice job of
> formatting, but the rotations are written as quaternion. I tried tweaking a
> quaternion to euler script in VB but failed. Below is a .x3d transform block.
> Mike
>
> <Transform DEF="pointData_032_TRANSFORM"
>    translation="9.958521 56.574299 -0.017123"
>    scale="0.154254 0.154254 0.154254"
>    rotation="0.000000 0.707107 0.707107 3.141593"
> >

You know, I think the solution might be quite easy since those values seem to be
angles in radians. Try converting the last three values to degrees like so:

#declare Rotation = rotate <0.707107, 0.707107, 3.141593> / pi * 180;

Sam


Post a reply to this message

From: Samuel B 
Subject: Re: brain bot progress rendering
Date: 25 Jul 2023 17:05:00
Message: <web.64c038c841b179eff8c47d526e741498@news.povray.org>
"Samuel B." <stb### [at] hotmailcom> wrote:
> You know, I think the solution might be quite easy since those values seem to be
> angles in radians. Try converting the last three values to degrees like so:
>
> #declare Rotation = rota...

Oops, that should read as:
 #declare Rotation = <0.707107, 0.707107, 3.141593> / pi * 180;


Post a reply to this message

From: Mike Miller
Subject: Re: brain bot progress rendering
Date: 25 Jul 2023 18:00:00
Message: <web.64c0447e41b179efb5177e91dabc9342@news.povray.org>
"Samuel B." <stb### [at] hotmailcom> wrote:
> "Samuel B." <stb### [at] hotmailcom> wrote:
> > You know, I think the solution might be quite easy since those values seem to be
> > angles in radians. Try converting the last three values to degrees like so:
> >
> > #declare Rotation = rota...
>
> Oops, that should read as:
>  #declare Rotation = <0.707107, 0.707107, 3.141593> / pi * 180;


Thanks, I'll give that a shot.
I was using something like this but in VB --- got odd rotation results.

def quaternion_to_euler_angle(w, x, y, z):
    ysqr = y * y

    t0 = +2.0 * (w * x + y * z)
    t1 = +1.0 - 2.0 * (x * x + ysqr)
    X = math.degrees(math.atan2(t0, t1))

    t2 = +2.0 * (w * y - z * x)
    t2 = +1.0 if t2 > +1.0 else t2
    t2 = -1.0 if t2 < -1.0 else t2
    Y = math.degrees(math.asin(t2))

    t3 = +2.0 * (w * z + x * y)
    t4 = +1.0 - 2.0 * (ysqr + z * z)
    Z = math.degrees(math.atan2(t3, t4))

    return X, Y, Z


Miller


Post a reply to this message

From: Samuel B 
Subject: Re: brain bot progress rendering
Date: 26 Jul 2023 18:40:00
Message: <web.64c1a08241b179eff8c47d526e741498@news.povray.org>
"Mike Miller" <mil### [at] gmailcom> wrote:
> "Samuel B." <stb### [at] hotmailcom> wrote:
> > "Samuel B." <stb### [at] hotmailcom> wrote:
> > > You know, I think the solution might be quite easy since those values seem to be
> > > angles in radians. Try converting the last three values to degrees like so:
> > >
> > > #declare Rotation = rota...
> >
> > Oops, that should read as:
> >  #declare Rotation = <0.707107, 0.707107, 3.141593> / pi * 180;
>
> Thanks, I'll give that a shot. [...]

Don't bother... it looks like was wrong. Check out this page:
https://edutechwiki.unige.ch/en/X3D_grouping_and_transforms

Here's the relevant bit:

"3.2 Rotations

Rotations are more difficult to understand, since it is possible to define any
arbitrary rotation axis.

rotation = 'x y z angle'
    x y z defines the rotation axis, angle is the amount of roation in radians
(i.e. 180 degrees = Pi)"

So, the first three numbers are the axis of rotation, and the fourth is the
amount of rotation in radians. The docs go on to give some tips but, if I'm not
mistaken, I think you can just plug the numbers directly into the
Axis_Rotate_Trans() macro in transforms.inc, making sure to do a radian->degree
conversion for the 4th value.

Sam


Post a reply to this message

From: Mike Miller
Subject: Re: brain bot progress rendering
Date: 26 Jul 2023 20:25:00
Message: <web.64c1b81d41b179efb5177e91dabc9342@news.povray.org>
"Samuel B." <stb### [at] hotmailcom> wrote:
> "Mike Miller" <mil### [at] gmailcom> wrote:
> > "Samuel B." <stb### [at] hotmailcom> wrote:
> > > "Samuel B." <stb### [at] hotmailcom> wrote:
> > > > You know, I think the solution might be quite easy since those values seem to
be
> > > > angles in radians. Try converting the last three values to degrees like so:
> > > >
> > > > #declare Rotation = rota...
> > >
> > > Oops, that should read as:
> > >  #declare Rotation = <0.707107, 0.707107, 3.141593> / pi * 180;
> >
> > Thanks, I'll give that a shot. [...]
>
> Don't bother... it looks like was wrong. Check out this page:
> https://edutechwiki.unige.ch/en/X3D_grouping_and_transforms
>
> Here's the relevant bit:
>
> "3.2 Rotations
>
> Rotations are more difficult to understand, since it is possible to define any
> arbitrary rotation axis.
>
> rotation = 'x y z angle'
>     x y z defines the rotation axis, angle is the amount of roation in radians
> (i.e. 180 degrees = Pi)"
>
> So, the first three numbers are the axis of rotation, and the fourth is the
> amount of rotation in radians. The docs go on to give some tips but, if I'm not
> mistaken, I think you can just plug the numbers directly into the
> Axis_Rotate_Trans() macro in transforms.inc, making sure to do a radian->degree
> conversion for the 4th value.
>
> Sam


>>  Axis_Rotate_Trans() macro in transforms.inc, making sure to do a radian->degree
conversion for the 4th value.

I'll give that a try...thanks so much!
Mike.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.