» it.EX9.HLSL.Introduzione
This site relies heavily on Javascript. You should enable it if you want the full experience. Learn more.

it.EX9.HLSL.Introduzione

English | French

Semantiche

da fare

Vettori e Swizzling

I tipi di dati come bool, int, float e double in HLSL possono essere anche usati come vettori scrivendo qualcosa come questo:

float4 ff = {4, 3, 2, 1};
bool2 bb = {1, 0};

Si possono ora raggiungere singoli elementi del vettore usando gli swizzles, che vengono aggiunti come suffissi al nome della variabile:

 .x, .y, .z, .w 

sono la stessa cosa di:

 .r, .g, .b, .a
float f = ff.a;     // f = 1
bool b = bb.y;      // b = 0
float2 f2 = ff.xz   // f2 = {4, 2}

Tabelle (Arrays)

Si possono dichiarare arrays con tutti i tipi di dati base, ma lo loro lunghezza dipende dal constant register count dello shader che si sta usando. Qui sotto si trovano i links per ulteriori informazioni su msdn:
vs_2_0 registers
ps_2_0 registers
vs_3_0 registers
ps_3_0 registers

Si possono definire arrays ed accederci come in questo esempio:

float4 ff[2] = {{0, 1, 2, 3}, {4, 5, 6, 7}}
float4 f1 = f[0];        //f1 = {0, 1, 2, 3}
float3 f2 = f[1].rgb;    //f2 = {4, 5, 6}

Funzioni Intrinseche

HLSL ha una piccola lista di funzioni built-in: facendo clic col tasto destro nell'editor degli shader di vvvv si fa comparire la lista.

Funzioni e Inclusioni

Assieme alle funzioni principali del vertex e pixelshader, può essere definito un numero illimitato di funzioni di supporto. Nel caso il codice risulti troppo complesso da gestire, si possono esportare le funzioni in un file di testo e ricollegarle tramite # include directive in questi due modi:

//local: the referenced file is placed in the same directory as the .fx file which includes it
#include "myfunctions.fxh" 
 
//global: the filename is specified relative to vvvvs root directory
#include <effects\myfunctions.fxh>

Profili Shader

In tutte le tecniche si deve specificare un profilo col quale si vogliono compilare le funzioni vertex e pixelshader: generalmente i profili sono più flessibili man mano che salgono di numerazione. Se lo shader comunica un errore riguardante le istruzioni impartitegli, si può tentare con un profilo con un numero più alto.

I dettagli sui profili shader possono essere trovati su msdn:
Shader Models vs. Shader Profiles

A seconda della potenza della scheda grafica, vvvv supporta questi profili:

  • vs_1_0, ps_1_0
  • vs_1_1, ps_1_1
  • vs_2_0, ps_2_0
  • vs_2_a, ps_2_a
  • vs_2_b, ps_2_b
  • vs_3_0, ps_3_0 //quando si usa vs_3_0, usare ps_3_0 è obbligatorio, in vvvv.

anonymous user login

Shoutbox

~4d ago

~7d ago

joreg: The Winter Season of vvvv workshops is now over but all recordings are still available for purchase: https://thenodeinstitute.org/ws23-vvvv-intermediates/

~14d ago

schlonzo: Love the new drag and drop functionality for links in latest previews!

~22d ago

joreg: Workshop on 29 02: Create Sequencers and Precise Clock Based Tools. Signup here: https://thenodeinstitute.org/courses/ws23-vvvv-08-create-sequencers-and-precise-clock-based-tools-in-vvvv-gamma/

~29d ago

joreg: Workshop on 22 02: Unlocking Shader Artistry: A Journey through ‘The Book of Shaders’ with FUSE. Signup here: https://thenodeinstitute.org/courses/ws23-vvvv-12-book-of-shaders/

~1mth ago

joreg: Talk and Workshop on February 15 & 16 in Frankfurt: https://visualprogramming.net/blog/vvvv-at-node-code-frankfurt/

~1mth ago

woei: @Joanie_AntiVJ: think so, looks doable

~1mth ago

xd_nitro: Anyone remember who increased projector brightness by removing some components that product the color?

~1mth ago

Joanie_AntiVJ: This looks super interesting (vectors over network) would anyone here know how to implement this in beta? https://github.com/madmappersoftware/Ponk