-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* agrego machete con las funciones mas comunes de hlsl (#78) * actualizo calendario para el 2c 2024 (#79)
- Loading branch information
1 parent
d6dc473
commit 540f5a1
Showing
2 changed files
with
165 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
fecha,actividad,tp,modalidad | ||
26/03/2024,[Nociones de gráficos por computadora](https://docs.google.com/presentation/d/13SGHD1smmkZSZ5RZ9af4C0v_oaSXpK5pQ8SAOGsQN9A),,Virtual | ||
02/04/2024,Sin Actividad – Día del Veterano y de los Caídos en la Guerra de Malvinas,, | ||
09/04/2024,[Transformaciones](https://docs.google.com/presentation/d/1Swn4KPXrVTW7QMxvIhDQIjBaBsWQer4SY2m5mc6LVGQ),Presentacion TP Cero,Laboratorio | ||
16/04/2024,[Render Pipeline](https://docs.google.com/presentation/d/1RQRYWBX9S9Qc5kwJmT_d2ASb7UfFxnlxSpODgkhI440),,Virtual | ||
23/04/2024,[Texturas y Nociones de Shaders](https://docs.google.com/presentation/d/1w1pWBYd3EHGwKs0o3v6ddjmhPZp5V6Hr-LEYHs5B3Mk),,Virtual | ||
30/04/2024,[Iluminación](https://docs.google.com/presentation/d/1nQ7xWib-3MoYDNirxEykiAHnsClffb00a57zjJyq7Zg),Primera entrega del TP,Virtual | ||
07/05/2024,[Colisiones](https://docs.google.com/presentation/d/1t2SnnMUZaa1AEQ5Hbrp319otKu8lhjE5xv7vm5jPO4c) y Fragment Shader,,Virtual | ||
14/05/2024,Practica de shaders,,Laboratorio | ||
21/05/2024,[Shaders de Post-Procesado](https://docs.google.com/presentation/d/1kkOsSZJjFzbnZw1duE_E5TUtG-0bC0yRuDnhzPCD134),Segunda entrega del TP,Virtual | ||
28/05/2024,[Optimización](https://docs.google.com/presentation/d/1XiWBmhVaKx0pbjBbObiDiNE1Zf4Rgw7T26YmRFda4No),,Virtual | ||
04/06/2024,Practica de shaders,Tercera entrega del TP,Virtual | ||
11/06/2024,Game engine workshop,,Laboratorio | ||
18/06/2024,Coloquio,,Laboratorio | ||
25/06/2024,Coloquio,Cuarta entrega del TP,Laboratorio | ||
02/07/2024,Presentación oral grupal del TP - Recuperatorio coloquio,Entrega final del TP,Laboratorio | ||
09/07/2024,Sin actividad – Día de la Independencia,, | ||
13/07/2024,Finalización del 1º Cuatrimestre,, | ||
03/08/2024,Última fecha firma de TP asignaturas Cuatrimestrales y Promociones,, | ||
13/08/2024,[Nociones de gráficos por computadora](https://docs.google.com/presentation/d/13SGHD1smmkZSZ5RZ9af4C0v_oaSXpK5pQ8SAOGsQN9A),,Virtual | ||
20/08/2024,[Transformaciones](https://docs.google.com/presentation/d/1Swn4KPXrVTW7QMxvIhDQIjBaBsWQer4SY2m5mc6LVGQ),Presentacion TP Cero,Laboratorio | ||
27/08/2024,[Render Pipeline](https://docs.google.com/presentation/d/1RQRYWBX9S9Qc5kwJmT_d2ASb7UfFxnlxSpODgkhI440),Presentacion TP,Virtual | ||
03/09/2024,[Texturas y Nociones de Shaders](https://docs.google.com/presentation/d/1w1pWBYd3EHGwKs0o3v6ddjmhPZp5V6Hr-LEYHs5B3Mk),,Virtual | ||
10/09/2024,[Iluminación](https://docs.google.com/presentation/d/1nQ7xWib-3MoYDNirxEykiAHnsClffb00a57zjJyq7Zg),Primera entrega del TP,Virtual | ||
17/09/2024,[Colisiones](https://docs.google.com/presentation/d/1t2SnnMUZaa1AEQ5Hbrp319otKu8lhjE5xv7vm5jPO4c) y Fragment Shader,,Virtual | ||
24/09/2024,Practica de shaders,,Laboratorio | ||
01/10/2024,[Shaders de Post-Procesado](https://docs.google.com/presentation/d/1kkOsSZJjFzbnZw1duE_E5TUtG-0bC0yRuDnhzPCD134),Segunda entrega del TP,Virtual | ||
08/10/2024,[Optimización](https://docs.google.com/presentation/d/1XiWBmhVaKx0pbjBbObiDiNE1Zf4Rgw7T26YmRFda4No),,Virtual | ||
15/10/2024,Practica de shaders,,Laboratorio | ||
22/10/2024,[Physically Based Rendering](https://docs.google.com/presentation/d/1PASgwE1Ku8aMQBzWxVE2YBrDnZv6Wq4jDpLWRX2wj64),Tercera entrega del TP,Virtual | ||
29/10/2024,-,,Virtual | ||
05/11/2024,Game engine workshop,,Virtual | ||
12/11/2024,Coloquio,Cuarta entrega del TP,Laboratorio | ||
19/11/2024,Coloquio,,Laboratorio | ||
26/11/2024,Presentación oral grupal del TP - Recuperatorio coloquio,Entrega final del TP,Laboratorio | ||
30/11/2024,Finalización del 2º Cuatrimestre,, | ||
05/03/2025,Última fecha firma de TP asignaturas Cuatrimestrales y Promociones,, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
--- | ||
layout: default | ||
title: HLSL Cheatsheet | ||
parent: Material | ||
--- | ||
|
||
# Referencia rapida de HLSL | ||
|
||
## Tipos de datos básicos, vectores y matrices | ||
|
||
```hlsl | ||
int a = 0; | ||
float time = 0.0f; | ||
float4 pos = float4(0,0,2,1); | ||
pos.x // = 0 | ||
pos.z // = 2 | ||
float2 temp = pos.yw // = float2(0,1) | ||
pos.rgb // = float3(0,0,2) | ||
pos.rgba // = float4(0,0,2,1) | ||
pos.aaaa // = float4(1,1,1,1) | ||
float2x2 fMatrix = { | ||
0.0f, 0.1, // row 1 | ||
2.1f, 2.2f // row 2 | ||
}; | ||
float4x4 mWorldViewProj; // Matriz de 4 x 4 | ||
float4x4 worldMatrix = float4( {0,0,0,0}, {1,1,1,1}, {2,2,2,2}, {3,3,3,3} ); | ||
worldMatrix[0][0]; // 1er elemento | ||
``` | ||
|
||
## Ejemplo de Vertex Shader y estructura de vértice | ||
|
||
```hlsl | ||
struct VS_OUTPUT | ||
{ | ||
float4 Position: POSITION; // vertex position | ||
float4 Diffuse : COLOR0; // vertex diffuse color | ||
}; | ||
VS_OUTPUT Vertex_Shader_Transform( | ||
in float4 vPosition : POSITION, | ||
in float4 vColor : COLOR0 ) | ||
{ | ||
VS_OUTPUT Output; | ||
Output.Position = mul( vPosition, | ||
mWorldViewProj ); | ||
Output.Diffuse = vColor; | ||
return Output; | ||
} | ||
``` | ||
|
||
## Ejemplo de Pixel shader | ||
|
||
```hlsl | ||
float4 Pixel_Shader( VS_OUTPUT in ) : COLOR0 | ||
{ | ||
float4 color = in.Color; | ||
return color; | ||
} | ||
``` | ||
|
||
## Semanticas Vertex shaders | ||
|
||
```hlsl | ||
struct VS_OUTPUT | ||
{ | ||
float4 Position : POSITION; | ||
float3 Diffuse : COLOR0; | ||
float3 Specular : COLOR1; | ||
float3 HalfVector : TEXCOORD3; | ||
float3 Fresnel : TEXCOORD2; | ||
float3 Reflection : TEXCOORD0; | ||
float3 NoiseCoord : TEXCOORD1; | ||
}; | ||
``` | ||
|
||
## Texturas | ||
|
||
### Inicializacion de samplers | ||
|
||
```hlsl | ||
sampler s = sampler_state | ||
{ | ||
texture = NULL; | ||
mipfilter = LINEAR; | ||
}; | ||
``` | ||
|
||
### Texture lookup | ||
|
||
```hlsl | ||
texture tex0; | ||
sampler2D s_2D; | ||
float2 sample_2D(float2 tex : TEXCOORD0) : COLOR | ||
{ | ||
return tex2D(s_2D, tex); | ||
} | ||
``` | ||
|
||
### Textura cúbica | ||
|
||
```hlsl | ||
texture tex0; | ||
samplerCUBE s_CUBE; | ||
float3 sample_CUBE(float3 tex : TEXCOORD0) : COLOR | ||
{ | ||
return texCUBE(s_CUBE, tex); | ||
} | ||
``` | ||
|
||
### Funciones intrínsecas HLSL | ||
|
||
```hlsl | ||
abs(value a) // absolute value (per component). | ||
acos(x) // arccosine of each component of x. | ||
atan(x) // arctangent of x. | ||
atan2(y, x) // arctangent of y/x. | ||
ceil(x) // smallest integer which is greater than or equal to x. | ||
clamp(x, min, max) // Clamps x to the range [min, max]. | ||
cos(x) // cosine of x. | ||
cross(a, b) // cross product of two 3D vectors a and b. | ||
distance(a, b) // distance between two points, a and b. | ||
dot(a, b) // dot product of two vectors, a and b. | ||
floor(x) // greatest integer which is less than or equal to x. | ||
fmod(a, b) // floating point remainder f of a / b | ||
frac(x) // fractional part f of x | ||
length(v) // length of the vector v. | ||
lerp(a, b, s) // Returns a + s(b - a) | ||
log(x) // base-e logarithm of x. | ||
mul(a, b) // Performs matrix multiplication between a and b. | ||
pow(x, y) // x^y. | ||
reflect(i, n) // Returns the reflection vector | ||
refract(i, n, R) // Returns the refraction vector v | ||
round(x ) // Rounds x to the nearest integer | ||
saturate(x) // Clamps x to the range [0, 1] | ||
sign(x) // Computes the sign of x. | ||
sin(x) // sine of x | ||
tan(x) // tangent of x | ||
tex2D(s, t) // 2D texture lookup. | ||
tex2Dlod(s, t) // 2D texture lookup with LOD. | ||
transpose(m) // transpose of the matrix m. | ||
``` | ||
|
||
## Recursos | ||
|
||
- [Guia de programación HLSL](https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-pguide) | ||
- [Referencia de HLSL](https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-reference) |