## XYZ Mask Help

Started by WAS, July 22, 2021, 02:24:26 pm

#### WAS

##### July 22, 2021, 02:24:26 pmLast Edit: July 22, 2021, 02:30:48 pm by WAS
I am trying to accurately mask a sphere based on XYZ. What is the best way to do that?

Additionally, I'd need the XYZ masks not including displacement. Just the spheroid and XYZ faces.

#### Matt

##### July 22, 2021, 06:30:33 pm #1 Last Edit: July 22, 2021, 06:34:21 pm by Matt
Method 1: "Get Normal in Geometry".

If you only need to texture a sphere or planet, use "Get Normal in Geometry". This gives you the surface normal of the undisplaced surface. For a sphere or spherical planet this is equal to the direction from the centre of the sphere.

https://planetside.co.uk/wiki/index.php?title=Get_Normal_in_Geometry

Method 2: "Get Position in Geometry", transform/offset, and "Normalize Vector".

If you use additional objects and want to merge them according to their position on the planet, you'll need use their shared world position. "Get Position in Geometry" gives you the undisplaced surface position in world space. You can follow this node with "Normalize Vector" to produce the direction from the origin, but not from the centre of the planet. If your planet is centred at 0,0,0 this gives you the same result as "Get Normal in Geometry". If your planet is NOT centred at the origin you'll need to use a transform or subtract the centre position before the normalize.

https://planetside.co.uk/wiki/index.php?title=Get_Position_in_Geometry
https://www.planetside.co.uk/wiki/index.php?title=Normalize_Vector
Just because milk is white doesn't mean that clouds are made of milk.

#### WAS

##### July 22, 2021, 08:06:31 pm #2
Thank you for taking time to reply, Matt. I've been working with planets at 0,0,0 to try and save from issues from forgetting my POO. I think method 1 should probably suffice. I always forget get normal/position in geometry is the original base for displacements. The "geometry" always ques me to think after displacements and the current state of geometry after disp.

Feel like I'm a kid trying to memorize something. Repeat: "geometry is NOT displaced state". Lol

#### WAS

##### July 22, 2021, 08:34:30 pm #3
I guess my only follow up question is how would I go about now (through method 1) getting the accurate negative faces? When I complement my scalars, they naturally extend up to the end of the base scalar. So Y is the top of the planet, which does match the transition to stretched Y disp/texture, but the complement extends like 3/4 the planet.

#### Matt

##### July 22, 2021, 08:38:18 pm #4
Use Negate instead of Complement. Or if you are already planning to use a Colour Adjust Shader, use negative white points and black points.

Negate(v) = -v
Complement(v) = 1-v
Inverse(v) = 1/v
Just because milk is white doesn't mean that clouds are made of milk.

#### WAS

##### July 22, 2021, 09:05:34 pm #5 Last Edit: July 22, 2021, 10:03:14 pm by WAS
Oh, ok. That explains that. Thank you.

Image attached for the visual people.

#### WAS

##### July 23, 2021, 12:58:35 pm #6
Huh. So another weird thing. I thought I could just Add Scalar the positive/negative sides into one scalar, but when you do that, you lose both scalars. Was hoping to compact the rig but I don't think it's possible? Even mixing scalars will result in no data.

Isn't -1+1=0?

#### WAS

##### July 24, 2021, 03:17:18 am #8
Even if you add/multiply to the base scalars, there is nothing. No 1+ or -1. Just nothing.

Ex. If I add 1 to the positive, that should be a range of  1 - 2, but if you add the range negate, there is no data again. That should be a range of 0-1 and.

#### Dune

##### July 24, 2021, 05:38:45 am #9
Strange. Sorry, can't help you solve that. Maybe use conditional scalar?

#### Mid-Knight Acchan

##### August 12, 2021, 01:17:52 pm #10
I'm not sure how to use the function. I made it with reference to the image, but the result is not accompanied. Am I doing something wrong?
I started 3D landscape with "Bryce" and am currently editing Japanese Wiki as a Terragen user. I am riding the Kawasaki ZEPHYR1100. I am a reader.

#### WAS

##### August 13, 2021, 03:55:43 pm #11 Last Edit: August 14, 2021, 11:03:51 pm by WAS
X to Scalar and Z to Scalar need their input from Get position in Geometry, not from Y to Scalars Negate.

Get Normal in Geometry is supplying a 0-1 range of scalar data which represents X, Y, and Z axis. We use the convert X|Y|Z Scalars to separate this data to use individually.

I have to say though, with what you did do, you seemed to create a Y based gradient masking system for different colours, possibly useful for gas giants.