Pages

marți, 11 iulie 2023

Graphics programming - Unity 3D shaders - 002.

In this article - tutorial I will show you how to use the most simple HLSL source code with Unity 3D.
You need to install the Shader Graph package in Unity 3D.
Create a basic shader with Create - Shader Graph - BuildIn - Unlit Shader.
Open this shader in the Shader Graph package and add a Custom Function.
This allows you to create variables and use an HLSL file.
You can see how I create this in this image:
Create a file and name this file with this name: MyNewCode.hlsl then add this in the Shader Graph package like in that image.
For each variable is need to use the Outputs to add these two variables: _in1 and _in2.
In the HLSL file, you can add this simple source code.
// file for custom node shader function
static float _input1Float = 1;
static float _input2Float = 1;
void Data_float(out float _in1, out float _in2)
{
    _in1 = _input1Float;
    _in2 = _input2Float;
  
}
Now, you have a custom node shader in your Shader Graph package project with an HLSL source code.

News : Adjusting Pivot Points on Objects in Daz Studio.

luni, 10 iulie 2023

News : New videos about Moho Animation Software.

You can find more on the official youtube channel.

Graphics programming - Unity 3D shaders - 001.

If you have studied shader theory and computational graphics in the past, then the only impediment would be the Unity 3D interface.
For a shader that uses the CG programming language, then you can use this type of shader in Unity 3D software.
You can create with right-click on Unity 3D interface.
This will create a shader file, you can open and see the default shader.
Let's make a CG shader with one color.
Remove all content from this file and add this source code:
Shader "Cg basic shader" { // this is the name of the shader 
   SubShader { // Unity chooses this like an subshader and works with your GPU specifications
      Pass { // passes in higher-level shader/material systems GLSL/Cg/HLSL is a way of setting up states necessary for multi-pass rendering, in this case is one pass
         CGPROGRAM // start programming with Unity's Cg

         #pragma vertex vert 
            // this specifies the vert function as the vertex shader 
         #pragma fragment frag
            // this specifies the frag function as the fragment shader
		// define vert for vertex shader 	
         float4 vert(float4 vertexPos : POSITION) : SV_POSITION 
            // vertex shader 
         {
            return UnityObjectToClipPos(vertexPos);
              // this line transforms the vertex input parameter 
              // and returns it as a nameless vertex output parameter 
              // (with semantic SV_POSITION)
         }
		 // define frag for fragment shader
         float4 frag(void) : COLOR // fragment shader
         {
            return float4(0.0, 1.9, 7.6, 1.0); 
               // this fragment shader returns a nameless fragment
               // output parameter (with semantic COLOR) that is set to
               // opaque red (red = 1, green = 0, blue = 0, alpha = 1)
         }

         ENDCG // ends the part in  programming with Unity's Cg
      }
   }
}
This is a standard shader and if you search on the web you can find more simple shaders.
Add an object to your scene, create a new material, and add to this object, drag the file shader to the material, and will fill with this RGBA color: 0.0, 1.9, 7.6, 1.0.

News : About my work and one of my websites.

I would like to bring to the attention of those who follow my activity on my websites and appreciate the inability to continue with one of the websites: free-tutorials.org. It is currently hosted on a free host, but I cannot import it 100%, which has led me not to complete it with new posts. The continuation of the activities there, considering the limited time, will be carried out on my blogs with the defined theme with which I started: Linux - Fedora, Graphics, Python, Pygame.
In the meantime, because the host is expensive and until now someone has helped me to host it on his server, it is possible to sell the domain: free-tutorials.org - I receive purchase offers at my personal Yahoo email address catafest@yahoo.com.
Minimum starting price 250 euros, because the domain is old from 2018.

duminică, 9 iulie 2023

News : GRIME free on Epic Games.

GRIME is a fast, unforgiving Action-Adventure RPG in which you crush your foes with living weapons that mutate form and function, and then consume their remains with a black hole to strengthen your vessel as you break apart a world of anatomical intrigue.