Wednesday, 23 October 2024

Water material in Unreal Engine 5.2 5.3 5.4 Lumen . Use for fluid geometry imported from Houdini, Maya , Blender, Realflow. Glass / water Shader Tutorial

 

export the fluid cache as single alembic. make sure it has no polygon with more than 4 sides. 

you can use @numvtx>4 in a houdini group expression node to figure out such polygons and triangulate them. unreal does not import geometry with polygons that has more than 4 sides. either triangles or quads accepted.

Water look example : 




1. Lumen On

 2. Forward Shading Off

 3.

4. 

5. 




6. 


7.  add thin translucent material node manually if its not automatically added.
8. turn on refraction from None to IOR






























Thursday, 11 May 2023

Gimbal lock

 Gimbal lock is a problem that can occur when using Euler angles to represent rotations in 3D graphics. It happens when two of the three rotational degrees of freedom (e.g., pitch, yaw, and roll) become aligned, causing a loss of one degree of freedom and making it impossible to represent certain rotations.


To understand gimbal lock, imagine a camera with three perpendicular axes that can rotate around each axis. These rotations are typically represented using Euler angles, which describe the rotation around each axis in a particular order (e.g., pitch, yaw, and roll). However, if the pitch angle is close to 90 degrees (i.e., the camera is looking straight up or down), the yaw and roll axes become aligned, and it becomes impossible to rotate the camera around the yaw or roll axis independently. This loss of one degree of freedom is called gimbal lock.


Gimbal lock can cause problems in 3D graphics applications because it can lead to unexpected behavior when rotating objects or cameras. For example, if a camera is looking straight up or down and the user tries to rotate it around the yaw or roll axis, the camera may suddenly "jump" to a different orientation due to the loss of one degree of freedom.


To avoid gimbal lock, many 3D graphics applications use quaternions to represent rotations instead of Euler angles. Quaternions are not subject to gimbal lock and can be smoothly interpolated between orientations, making them a more robust choice for representing rotations in 3D space.

Quaternion

 A quaternion is a four-dimensional vector that is commonly used to represent rotations in 3D space. A quaternion can be represented as q = w + xi + yj + zk, where w is the scalar part and (x, y, z) is the vector part.

In 3D graphics programming, quaternions are often used to represent rotations because they can be interpolated smoothly and are not subject to gimbal lock, a problem that can occur when using Euler angles to represent rotations.
Quaternions have several properties that make them useful for representing rotations. For example:
- They can be composed using a simple multiplication operation, making it easy to concatenate multiple rotations.
- They can be normalized to represent a pure rotation, allowing for easy interpolation between two orientations.
- They are immune to gimbal lock, a problem that can occur when using Euler angles to represent rotations.

In practice, quaternions are often used in combination with matrices to represent rotations in 3D space. The matrix can be used to transform a point in space, while the quaternion can be used to represent the rotation applied to the matrix.
Quaternions are widely used in computer graphics, game development, and robotics, among other fields.

Wednesday, 10 May 2023

Explanation of object space and world space in vex context

 In VEX, "object space" and "world space" are two different coordinate systems used to represent the position and orientation of objects in a scene.


"Object space" refers to the local coordinate system of a specific object in the scene. This coordinate system is relative to the object's origin, which is typically located at the center of the object's geometry. In object space, the X, Y, and Z axes are aligned with the object's local axis system.


"World space" refers to the global coordinate system of the scene. This coordinate system is fixed and does not change, regardless of the position or orientation of individual objects in the scene. In world space, the X, Y, and Z axes are aligned with the global axis system of the scene.


When working with VEX in Houdini, you may need to transform vectors or points from one coordinate system to another. For example, if you want to move an object from its current position in object space to a new position in world space, you would need to transform the object's position vector from object space to world space.



Fundamental Notes on Vector Expression Language - VEX coding in Houdini

Basics:  


So you want to learn VEX! 

VEX can be a powerful tool to achieve complex effects in Houdini. Here are some tips to get started:

  1. Start with the basics: Begin with understanding basic programming concepts such as variables, data types, and control flow. Once you have a good grasp of these, move on to learning VEX-specific concepts such as vectors, matrices, and functions.

  2. Learn by doing: Practice is the key to mastering any programming language. Start with small projects and gradually move on to more complex ones. Houdini provides a number of tutorials and example files that can help you get started.

  3. Use the Houdini documentation: Houdini has extensive documentation on VEX that can be accessed through the Help menu. You can also access it online at https://www.sidefx.com/docs/houdini/vex/index.html.

  4. Join the community: Houdini has a strong community of users who are always willing to help out. Join forums such as the SideFX forum or Reddit's Houdini subreddit to ask questions and learn from other users.

  5. Experiment: Don't be afraid to experiment and try out different approaches to achieve your desired effect. VEX can be a powerful tool, and with some creativity, you can achieve some amazing results.

I hope these tips help you get started with learning VEX.

To get you started here are some basics of VEX: 1. Variables: VEX supports different data types such as integers, floats, and vectors. You can declare variables using the `int`, `float`, and `vector` keywords, respectively. For example:


  
   int myInteger = 10;
   float myFloat = 3.14;
   vector myVector = {1, 2, 3};
   
   
2. Operators: VEX supports a variety of operators, including arithmetic, comparison, and logical operators. For example:

   int a = 10;
   int b = 5;
   int c = a + b; // adds a and b and assigns the result to c
   int d = a > b; // assigns 1 to d (true) because a is greater than b
   int e = !d; // assigns 0 to e (false) because !d means not d
   
3. Functions: VEX provides a range of built-in functions that can be used for various tasks, such as math functions, string manipulation, and vector operations. For example:

   float myFloat = 3.14;
   float myAbs = abs(myFloat); // assigns 3.14 to myAbs
   vector myVector = {1, 2, 3};
   vector myNormalizedVector = normalize(myVector); 
   // normalizes the vector and assigns it to myNormalizedVector
  
4. Control Flow: VEX supports if-else statements and loops such as for and while loops. For example:

   int a = 10;
   int b = 5;
   if (a > b) {
       printf("a is greater than b");
   } else {
       printf("a is not greater than b");
   }

   for (int i = 0; i < 10; i++) {
       printf("i is %d", i);
   }
  
  
These are just some of the basics of VEX. As you dive deeper into VEX, you will learn about more advanced concepts such as structs, arrays, and shaders.

Saturday, 1 October 2022

Extracting camera space procedural geometry edge in houdini using dot product (.hip file attached)

 




1. Object merge your geometry and camera inside a geometry node.  make sure both transform are set to Into This Object.




2. use an attribute wrangle to read the position data

    like so:

            

v@camN = point(1, "P", 0) - @P; // calculating the ray from camera to the point

v@objN = @N;



 

3. take an attribute vop and connect it below the wrangle. inside this we will do dot product to find the edge of the geometry in camera space. 

    here first we read the objN and camN position attributs. then multiply objN with a float to make the effect more prominent. then plug both camN and multiplied objN into a dot product node. we use dot product to find if the ray from camera and the normal on the particular point are in right angle.

if they are in right angle, dot product will produce a value of zero. above 90 degrees it will produce -ve value and below 90 degrees it will produce +ve values. 

4. so, then we plug this value into a ramp and set the ramp type to spline. (you can use RGB ramp as well). 

5. and finally we connect the ramp output to Cd. then after we adjust the ramp a bit we should be able to see the edge appear on the geometry.




So if everything has been done right, we should be able to see the edge and make it thicker or change its position using the ramp and N_Multiply.



example file:  https://learnhoudini.gumroad.com/l/houdiniproceduraledgedetection


Thursday, 29 September 2022

houdini pcopen , pcfilter - to bring particles / points closer together

 

float radius= .25;

int maxpoints = 50;

int handle = pcopen(0,"P",@P, radius, maxpoints);

@P= pcfilter(handle, "P");