How to use Math Nodes?

Smart people ~ Great Scripts
Post Reply
User avatar
Draise
Captain
Posts: 2896
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

How to use Math Nodes?

Post by Draise » 24 Apr 2015, 19:44

trueSpace seems to be equiped with a large number of math nodes.

Unfortunately I don't know how to use them. I have no Scalar float, no Vector floats, no Integer or Boolean float input. I can't really use the Math Nodes (or I have no idea how to).

How do I create a Boolean input? Or a Scalar (that isn't a "float" input)? How do I use all these nodes? How do I connect all these nodes together?

And ultimately, how do I convert a scalar number into an integer!? (main goal)

clintonman
Captain
Posts: 2080
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: How to use Math Nodes?

Post by clintonman » 25 Apr 2015, 14:20

I think the math nodes are only for use inside materials.
Clinton Reese

http://clintons3d.com

User avatar
Draise
Captain
Posts: 2896
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: How to use Math Nodes?

Post by Draise » 25 Apr 2015, 15:20

Oh. So I'd need to create these with Javascript and make my own nodes?

User avatar
trueBlue
Commander
Posts: 1404
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: How to use Math Nodes?

Post by trueBlue » 25 Apr 2015, 15:39

I think the Math nodes can be used for Objects and the Component nodes can be used for Materials.
All of these nodes are compiled and are more efficient compared to using it in Jscripts.
You can also use the BinaryOp and UnaryOp with math operands like * = multiply, \ = Divide, etc...
Capture.JPG
HLSL Script Brick is used for D3D materials and is a different language.
Capture2.JPG
Scalar is the same as a Real number in Rosetta.
You do not have the required permissions to view the files attached to this post.

User avatar
Draise
Captain
Posts: 2896
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: How to use Math Nodes?

Post by Draise » 25 Apr 2015, 17:20

Ah yes, I use the BinaryOp and UnaryOp a lot. They work with Real Number, or Scalar as you say! Yeah!

I'd like to convert a Scalar to an Integer or boolean though.. I guess I don't know how to "round" out scalars using the BinaryOp, or basic maths. I'd need an "If" node no?

I can't seem to use the Math nodes with any BinaryOp or UnaryOp.

clintonman
Captain
Posts: 2080
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: How to use Math Nodes?

Post by clintonman » 25 Apr 2015, 17:34

maths.jpg
I forgot about those and I did some digging and it looks like there are some other useful nodes waiting to be created.
The formula node is neat. See the before and after the formula is entered at the lower right.

I found the info below in a beta version of the original tS manual in the reference section.
http://clintons3d.com/stuff/" onclick="window.open(this.href);return false; the file is named ts7_help.chm

Binary Op takes +, -, *, /, max, min
Unary Op takes sin, cos, abs, pow, neg

"Math Formula node finds variables in given formula, adds these variables as connectors and compute result of the formula depending on values of variables. Node recognizes and computes following strings in the formula:

- binary operations: ^,*,/,-,+

- functions: sin, cos, tan, arcsin, arcos, sqrt, ln, log ,exp

- constants: PI, real numbers

- variables: any other strings

Example of formula: (a+c)*sin(a+c)-PI*log(c+d)/3.2

"
You do not have the required permissions to view the files attached to this post.
Clinton Reese

http://clintons3d.com

User avatar
Draise
Captain
Posts: 2896
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: How to use Math Nodes?

Post by Draise » 25 Apr 2015, 23:22

Very handy your help file! Now I understand a bit more about scripting and making node programming in trueSpace. I can see potential to make particle systems, rough AI systems, and other things - even procedural geometry.. hmm.... just thinking.

I also know.. that with the power of Javascript I can.. and did make my Float to Integer (Scalar to Integer) converter. I am still learning Javascript, but it's kinda working. Now I can make a pixelized character of a sort. Let me first make a proof of concept..... hmm.

I still don't have much clue as to know how to apply trigonometry though with the Sin, Con and others...

Download Float (Scalar or Real Number) to Integer

User avatar
trueBlue
Commander
Posts: 1404
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: How to use Math Nodes?

Post by trueBlue » 26 Apr 2015, 13:43

If you make it with a jScript Object you will not need the Watch Dog, which can be unreliable when encapsulated.
Capture.JPG
You do not have the required permissions to view the files attached to this post.

froo
Captain
Posts: 2552
Joined: 22 May 2009, 12:13

Re: How to use Math Nodes?

Post by froo » 27 Apr 2015, 19:17

Hey Draise.
Not sure if a node exists but you can convert (force) a scalar to an integer by casting it to type: int.
Also not sure how to do that in jscript; it's been quite awhile since I've delved into code; doing less fun
stuff lately (like boring documentation ugh!).

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest