ShaderX2: DirectX 9 셰이더 프로그래밍

Similar documents
ShaderX2: DirectX 9 셰이더 프로그래밍 팁 & 트릭

<4D F736F F F696E74202D204D41544C4142B0ADC0C7B7CF28B9E8C6F7BFEB295F3031C0E55FBDC3C0DBC7CFB1E22E BC8A3C8AF20B8F0B5E55D>

초보자를 위한 C# 21일 완성

歯PLSQL10.PDF

A 0 D5-a (XQD Card Type) D5-b (CF Card Type)

°ø±â¾Ð±â±â

Microsoft PowerPoint - 기계공학실험1-1MATLAB_개요2D.pptx

초보자를 위한 C++

Java 3D Programming

중 국 6 대 패 션 시 장 조 사 보 고 서 < 2004 년 상 해 10 대 매 장 10대 패 션 제 품 의 브 랜 드 시 장 점 유 뮬 > 제 품 브 랜 드 시 장 점 유 율 제 품 브 랜 드 시 장 점유 율 C O N C H P LA Y B O Y

fx-82EX_fx-85EX_fx-350EX

A 001~A 036

-주의- 본 교재는 최 상위권을 위한 고난이도 모의고사로 임산부 및 노약자의 건강에 해로울 수 있습니다.

百 눼신 시 " 가.인도의 대표적 섬유,패션 제품 l) 카펫 면과 비단으로 만든 카펫은 수세기 동안 인기있는 수출 품옥이었다.무굴시대의 디 자인 감각으로 완성된 플러시 비단카펫은 오늘날까지 관광객에게 많은 사랑을 받는 제품이다.인도산 수직 매듭 양탄자 두리(Dur ie

초보자를 위한 자바 2 21일 완성 - 최신개정판

NSK-Ç¥Áö_º»»ç

13 2 ( 25 ) Korean J Med Hist Dec 2004 ISSN X * ( ) ( ) ( ). 1) ( ) ( ) ( ) ( ) ( ) 2) ( ) 3) 1990 ( ) 4) * 1) ( ) C

SRC PLUS 제어기 MANUAL

OpenGL 프로그래밍 가이드 제4판

(Asynchronous Mode) ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 -

untitled

0

I 154

Microsoft Word - FS_ZigBee_Manual_V1.3.docx

초보자를 위한 ASP.NET 2.0

Windows 시스템 프로그래밍 제3판


PowerPoint 프레젠테이션

03장.스택.key

(001~042)개념RPM3-2(정답)

歯IC-706.PDF

hwp

서피스셰이더프로그램 셰이더개발을쉽게! Thursday, April 12, 12

DV690-N_KOR_ indd

( )박용주97.PDF

[8051] 강의자료.PDF

K&R2 Reference Manual 번역본

歯320.PDF

C프로-3장c03逞풚

PowerPoint 프레젠테이션

(해01~40)300제(물리Ⅰ)-ok

초보자를 위한 C++

334 退 溪 學 과 儒 敎 文 化 第 55 號 角 說 에서는 뿔이 난 말과 고양이라는 기형의 동물을 소재로 하여 당대 정치 상 황을 비판하였고, 白 黑 難 에서는 선과 악을 상징하는 색깔인 白 과 黑 이 서로 벌이 는 문답을 통하여 옳고 그름의 가치관이 전도된 현실세

Bchvvhv[vhvvhvvhchvvhvvhvvhvvhvvgvvgvv}vvvgvvhvvhvvvhvvhvvhvvvbbhvvhvvvgvvgvvhvvhvvhv}hv,.. Bchvvhv[vhvvhvvhvvhvvbbhvvhvvhvvvhvvhvvgvvgvv}vvgvvhvvvhvv

프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어

정규식 사용하기

HW5 Exercise 1 (60pts) M interpreter with a simple type system M. M. M.., M (simple type system). M, M. M., M.

DCR-HC15


1. 화섬산업의 개요 1.1 화섬산업의 륵성 화 섬산 업 의 산 업 적 특 성 화섬산업은 원사,원면 둥 기초소재를 생산하는 섬유산 업의 핵심산업으로 고용창출효과와 고부가가치를 실현할 수 있음 O 세계적으로 독일,이태리,일본 등 선진국을 중심으로 M E(마이크로 일렉트

歯FFF01379.PDF

초보자를 위한 한글 Visual Basic .NET 21일 완성

歯9장.PDF

chap10.PDF

ALPHA I 500M(현대삼호) service manual(kor).hwp

°ø¾÷-01V36pš

dnu.pdf

Microsoft PowerPoint - GameProgramming23-PixelShader.ppt

Beginning Linux Programming 제3판


歯표지.PDF

untitled

untitled

AD AD 8-0 / A A-2 / A A A-5 / A A T-T / Q


ü M ysql 관련 PHP API 함수이해 ü PHP API 함수의활용 ü <form> 태그활용법 ü 변수전달방식의이해 ü API 함수를이용한데이터베이스관리

HWP Document

fx-570EX_fx991EX

hwp

hlogin2

Microsoft PowerPoint - 3ÀÏ°_º¯¼ö¿Í »ó¼ö.ppt

歯엑셀모델링

9

a16.PDF

NERO_M128_V10.opj

untitled

2 A A Cs A C C A A B A B 15 A C 30 A B A C B. 1m 1m A. 1 C.1m P k A B u k GPS GPS GPS GPS 4 2

MPLAB C18 C

, ( ),, ( ), 3, int kor[5]; int eng[5]; int Microsoft Windows 4 (ANSI C2 ) int kor[5] 20 # define #define SIZE 20 int a[10]; char c[10]; float

02544Ac07¥Áöš

untitled

1

ELECTRICAL PARTS LIST (CA-6215) Ref No. Part No. Description Value Qty AMP B'D ( B ) C1406 C CAP NPP POLY 152J 2J 152P 2 C140

< B3E2C1B6BBE7BAD0BCAEBAB8B0EDBCAD2DBFCFBCBABABB28BEF6C0CDC3B5292E687770>


EMBARCADERO TECHNOLOGIES (Humphery Kim) RAD Studio : h=p://tech.devgear.co.kr/ : h=p://blog.hjf.pe.kr/ Facebook : h=p://d.com/hjfactory :

CPX-E-PB_BES_C_ _ k1



???짚?

자바로

436 8., {(x, y) R 2 : y = x, < x 1} (, 1] φ(t) = (t, t), (, 2] ψ(t) = (t/2, t/2), [1, ) σ(t) = (1/t, 1/t).. ψ φ, σ φ. (φ, I) φ(i) φ : I φ(i). 8.2 I =

(72) 발명자 오인환 서울 노원구 중계로 195, 101동 803호 (중계동, 신 안동진아파트) 서혜리 서울 종로구 평창14길 23, (평창동) 한훈식 서울 강남구 언주로71길 25-5, 301호 (역삼동, 영 훈하이츠) 이 발명을 지원한 국가연구개발사업 과제고유번호

ePapyrus PDF Document

DocsPin_Korean.pages

차례 제 1 장 MATLAB 연습 MATLAB에서사용되는기호들

hapter_ i i 8 // // 8 8 J i 9K i? 9 i > A i A i 8 8 KW i i i W hapter_ a x y x y x y a /()/()=[W] b a b // // // x x L A r L A A L L A G // // // // /


OCaml

5.스택(강의자료).key

Transcription:

1. Dire c tx 고수준 셰이딩 언어 HLSL에 대한 소개 Craig Peeper & Jason L. Mitchell

HLSL(High Level Shading Language) DirectX 9.,. HLSL,,,. ShaderX 2 : DirectX 9 & HLSL,. HLSL. HLSL, procedural wood 1) HLSL HLSL. HLSL. f l oat 4x4 vi ew_proj_mat r i x; f l oat 4x4 t ext ure_mat r i x0; st r uct VS_PUTOUT f l oat 4 Pos f l oat 3 Pshade ; : POSITION; : TEXCOORD0; VS_OUTPUT mai n (f l oat 4 vposi t i on : POSITION) VS_OUTPUT Out = (VS_OUTPUT) 0; 1) : (procedure)

1. DirectX HLSL 27 / / Out. Pos = mul (vi ew_proj_mat r i x, vposi t i on) ; / / Pshade Out. Pshade = mul (t ext ure_mat ri x0, vposi t i on) ; ret ur n Out ; vi ew_proj_mat r i x t ext ure_mat r i x0 4 4. f l oat 4 Pos f l oat 3 Pshade VS_OUTPUT. mai n f l oat 4, VS_OUTPUT. f l oat 4 vposi t i on, VS_OUTPUT. POSITION TEXCOORD0. (semantic),. mai n vposi t i on vi ew_proj_mat r i x mul.. mul vposi t i on, mul., vposi t i on mul vpos i t i on (mul ). vposi t i on (clip space), 3D vposi t i on t ext ur e_mat r i x0. ( / ).., 3D Pshade (interpolator). HLSL procedural wood., ps_2_0.

f l oat 4 l i ght Wood; / / f l oat 4 dar kwood; / / f l oat r i ngfreq; / / sampl er Pul setrai nsampl er ; f l oat 4 hl sl _ri ngs (f l oat 4 Pshade : TEXCOORD0) : COLOR f l oat scal eddi st FromZAxi s = sqrt (dot (Pshade.xy, Pshade.xy) ) * ri ngfreq; f l oat bl endfact or = t ex1d (Pul setrai nsampl er, scal eddi st FromZAxi s ) ; ret ur n l er p (dar kwood, l i ght Wood, bl endfact or ) ; 4 2. Pul setrai nsampl er... Pshade,. z-, / Pul se Trai nsampl e r 1. Tex1D( ) (l i ght wood dar kwood). 4D. 4D RGBA.. HLSL. HLSL Direct3D, D3DX,

[ Dire c tx 9 D3D 1. DirectX HLSL 29. DirectX 8.0 Direct3D., 3D.. DirectX 8.0 DirectX 8.1 (vs_1_1 ps_1_1 ~ ps_1_4 ). [ 1-1] D3DXAs sembl eshader () DX3D, Creat epi xel Shade r () Creat ever t exshader () Direct3D. Direct3D ShaderX & ( ). 1-1] Dire c tx8 [ 1-1], DirectX9 HLSL D3DXCompi l eshader ( ) API D3DX, Creat epi xel Shader () Creat e Vert exshader () direct3d..,,. Direct3D HLSL. HLSL D3D

, HLSL DX SDK. DirectX 9 D3DX HLSL 3D. (vs_2_0, vs_3_0, ps_2_0 ps_3_0), HLSL. HLSL. D3DXCompi l eshade r () API HLSL D3DX. API. HLSL, Direct3D. HLSL.. HLSL. HLSL., HLSL.

1. DirectX HLSL 31., HLSL 6. ps_1_1 ps_1_1 4.. HLSL. HLSL.,, if-else.,, if-else, if-else.,. - fxc HLSL D3DX.,. fxc DirectX 9 SDK.,...

-T target ( : vs_2_0) -E name name( : main) -Od -Vd -Zi -Zpr -Zpc -Fo file -Fc file -Fh file -D id = text -nologo HLSL... HLSL. HLSL. HLSL. (*),. asm* bool compi l e const decl * do doubl e el se ext er n f al se f l oat f or hal f i f i n i nl i ne i nout i nt mat r i x* out

1. DirectX HLSL 33 pass* pi xel shader * ret urn sampl er shared st at i c st r i ng* st r uct t echni que* t ext ure* t r ue t ypedef uni f orm vect or * vert exshader * voi d vol at i l e whi l e. aut o break case cat ch char cl ass compi l e const const _cast cont i nue Def aul t del et e dynami c_cast enum expl i ci t f r i end got o l ong mut abl e namespace new operat or pr i vat e prot ect ed publ i c regi st er rei nt erpret _cast short Si gned si zeof st at i c_cast swi t ch t empl at e t hi s t hrow t ry t ypename uni on unsi gned usi ng vi rt ual HLSL.. bool int half float double 32 16 32 64

.,. half double. float. HLSL.. vector vector<type, size> 4, size, type, 2 4. 4 f l oat. f l oat 4 f Vect or0; f l oat f Vect or 1[4] ; vect or f Vect or2 ; vect or <f l oat, 4> f Vect or3; 3 bool. bool 3 bvect or0; bool bvect or1[3] ; vect or <bool, 3> bvect or2; (swizzle).

1. DirectX HLSL 35 x, y, z, w r, g, b, a ( )., f l oat 4 pos = 3.0f, 5.0f, 2.0f, 1.0f ; f l oat val ue0 = pos [0] ; / / val ue0 3.0f f l oat val ue1 = pos.x; / / val ue1 3.0f f l oat val ue2 = pos.g; / / val ue2 5.0f f l oat 2 vec0 = pos.xy; / / vec0 3.0f, 5.0f f l oat 2 vec1 = pos. ry; / /! Ps_2_0.. HLSL 2D. bool, i nt, hal f, f l oat doubl e., 4 4. 2 4 4 f l oat. f l oat 4x4 vi ew_proj_mat r i x; f l oat 4x4 t ext ure_mat r i x0;,., 3 4. f l oat 3x4 mat 0; mat r i x<f l oat, 3, 4> mat 1;

, /. vi ew_proj_mat r i x. f l oat f Val ue = vi ew_proj_mat r i x[0] [0] ;. 0. _m00, _m01, _m02, _m03 _m10, _m11, _m12, _m13 _m20, _m21, _m22, _m23 _m30, _m31, _m32, _m33 1. _11, _12, _13, _14 _21, _22, _23, _24 _31, _32, _33, _34 _41, _42, _43, _44. f l oat 2x2 f Mat = 3.0f, 5.0f, / / 1 2.0f, 1.0f ; / / 2 f l oat val ue0 = f Mat [0] ; / / val ue0 3.0f f l oat val ue1 = f Mat._m00; / / val ue1 3.0f f l oat val ue2 = f Mat._12 / / val ue2 5.0f f l oat val ue3 = f Mat [1] [1] / / val ue3 1.0f f l oat 2 vec0 = f Mat._21_22 ; / / vec0 2.0f, 1.0f f l oat 2 vec1 = f Mat [1] ; / / vec1 2.0f, 1.0f (typ e mo d ifie r) HLSL. const..

1. DirectX HLSL 37 row_maj or col _maj or. row_maj or, col_maj or. (col_major). (sto ra g e c la ss mo d ifie r).,. C, st at i c ext ern ( ). st at i c, API. st at i c API. C, st at i c. ext ern API, ext ern. shared ef f ect. uni f orm HLSL (Set *Shader Const ant *() API ). uni f orm. const.,. ext er n f l oat t ransl ucencycoef f ; const f l oat gl oss_bi as ; st at i c f l oat gl oss_scal e ; f l oat di f f use ; di f f use t ransl ucencycoef f Set ShaderConst ant () API,. const gl oss_bi as Set *Shader Const ant *() API,.

, st at i c gloss_scale Set *ShaderConst ant *() API,. C. f l oat 2x2 f Mat = 3.0f, 5.0f, / / ( 2.0f, 1.0f ; / / 2. ) f l oat 4 vpos = 3.0f, 5.0f, 2.0f, 1.0f ; f l oat f Fact or = 0.2f ; HLSL. 3D.,. f l oat 4 vtone = vbr i ght ness * vexposure ; vbri ght ness vexposure f l oat 4. f l oat 4 vtone ; vtone.x = vbri ght ness.x * vexposure.x; vtone.y = vbri ght ness.y * vexposure.y; vtone. z = vbri ght ness. z * vexposure. z; vtone.w = vbri ght ness.w * vexposure.w; 4D vbri ght ness vexposure.. mul ().

1. DirectX HLSL 39 (c o nstruc to r) HLSL C++,.. f l oat 3 vpos = f l oat 3(4.0f, 1.0f, 2.0f ) ; f l oat f Di f f use = dot (vnormal, f l oat 3(1.0f, 0.0f, 0.0f ) ) ; f l oat 4 vpack = f l oat 4(vPos, f Di f f use ) ; (dot (vnormal, f l oat 3 (1.0f, 0.0f, 0.0f ) dot f l oat 3 ), (vect or3 vect or4 f l oat 4(vPos, f Di f f use) ). f l oat 4 f l oat 3 f l oat f l oat 4. (typ e c a sting ) HLSL.., vresul t f l oat 0.0f f l oat 4(0.0f, 0.0f, 0.0f, 0.0f ). f l oat 4 vresul t = 0.0f ;..,. f l oat 3 vli ght ; f l oat f Fi nal, f Col or ; f Fi nal = vli ght * f Col or ; vli ght x fcol or. f Fi nal = vli ght.x * fcol or.

HLSL.. bool false 0, true 1. bool 0 false, 0 true.. C...........................

1. DirectX HLSL 41 (struc ture ), HLSL., mai n ( f l oat 4 ). NPR Metallic. st r uct VS_OUTPUT f l oat 4 Pos : POSITION; f l oat 3 Vi ew : TEXCOORD0; f l oat 3 Normal : TEXCOORD1; f l oat 3 Li ght 1: TEXCOORD2 ; f l oat 3 Li ght 2 : TEXCOORD3; f l oat 3 Li ght 3 : TEXCOORD4 ; ; HLSL. (sa m p le r) sampler. hl sl_ri ngs (). f l oat 4 l i ght Wood; / / f l oat 4 dar kwood; / / f l oat r i ngfreq; / / sampl er Pul setrai nsampl er ; f l oat 4 hl sl _r i ngs (f l oat 4 Pshade : TEXCOORD0) : COLOR f l oat scal eddi st FromZAxi s = sqrt (dot (Pshade.xy, Pshade.xy) ) * r i ngfreq; f l oat bl endfact or = t ex1d (Pul setrai nsampl er, scal eddi st FromZAxi s ) ; ret ur n l er p (dar kwood, l i ght Wood, bl endfact or ) ;

Pul setrai nsampl er t ex1d(). HLSL D3D API, 3D uv.,. ShaderX 2 : DirectX 9 &,., 2 Sobel (dx, dy ) (Height map) (Normal map). sampl er Input Image ; f l oat 4 mai n (f l oat 2 t oplef t : TEXCOORD0, f l oat 2 l ef t : TEXCOORD1, f l oat 2 bot t omlef t : TEXCOORD2, f l oat 2 t op : TEXCOORD3, f l oat 2 bot t om : TEXCOORD4, f l oat 2 t opri ght : TEXCOORD5, f l oat 2 r i ght : TEXCOORD6, f l oat 2 bot t omri ght : TEXCOORD7) : COLOR / / 8. f l oat 4 t l = t ex2d (I nput I mage, t oplef t ) ; f l oat 4 l = t ex2d (I nput I mage, l ef t ) ; f l oat 4 bl = t ex2d (I nput I mage, bot t omlef t ) ; f l oat 4 t = t ex2d (I nput I mage, t op) ; f l oat 4 b = t ex2d (I nput I mage, bot t om) ; f l oat 4 t r = t ex2d (I nput I mage, t opri ght ) ; f l oat 4 r = t ex2d (I nput I mage, r i ght ) ; f l oat 4 br = t ex2d (I nput I mage, bot t omri ght ) ; / / Sobel dx. / / / / -1 0 1 / / -2 0 2 / / -1 0 1

1. DirectX HLSL 43 f l oat dx = -t l.a - 2.0f *l.a - bl.a + t r.a + 2.0f *r.a + br.a ; / / dy Sobel. / / / / -1-2 -1 / / 0 0 0 / / 1 2 1 f l oat dy = -t l.a - 2.0f *t.a - t r.a + bl.a + 2.0f *b.a + br.a ; / /. f l oat 4 N = f l oat 4 (normal i ze (f l oat 3( -dx, -dy, 1) ), t l.a ) ; / / ( -1...1) (0... 1). ret ur n N * 0.5f + 0.5f ; 1, Input Image t ex2d() 8. DirectX HLSL. ( ), t ex1d() t ex2d(). HLSL. abs () dot (), ref ract (), st ep()., ddx(), ddy(), fwi dt h().

abs(x) acos(x) all(x) any(x) asin(x) atan(x) atan2(y, x) ceil(x) clamp(x, min, max) Clip(x) cos(x) cosh(x) cross(a, b) D3DCOLORtoUBYTE4(x) ddx(x) ddy(x) degrees(x) determinant(m) distance(a, b) dot(a, b) exp(x) exp2(a) faceforward(n, i, ng) floor(x) (x ). x. [ 1, 1]. x 0. x 0. x. [ p/2, p/2]. x. [ p/2, p/2]. y/x. y x [-p, p]. atan2, x 0 y 0. x. [min, max]. x 0. x. texkill. x. x (hyperbolic cosine). a, b. 4D x UBYTE4. x. y. (0 360 ). m. a, b. a, b. e x. 2 x ( ). n * sign(dot(i, ng)). x.

1. DirectX HLSL 45 fmod(a, b) frac(x) frexp(x, out exp) fwidth(x) isfinite(x) isinf(x) isnan(x) a/b ( ). a = i * b + f I, f x, f b. X x. frexp exp. x 0 0. abs(ddx(x))+abs(ddy(x)). x true, false. x +INF INF true, false. x NAN QNAN true, false. CNAN:Net a numbor- ldexp(x, exp) * 2 ex p. len(v) length(v) lerp(a, b, s) log(x) log10(x) log2(x) max(a, b) min(a, b) modf(x, out ip) mul(a, b) normalize(v) pow(x, y) radians(x) reflect(i, n) v. s 0 a, 1 b a b a + s(b a). e x. x indefinite. x 0 +INF. 10 X. x indefinite, 0 +INF. 2 x. x indefinite, 0 +INF. a b. a b. x x., out ip. a b. a. b. a b. a b. v/length(v) v. v 0.. xy. x (radian). v. I, n v = i 2 * dot(i, n) * n.

refract(i, n, eta) round(x) rsqrt(x) saturate(x) v ( I, n, eta ). eta n I refract (0, 0, 0). x. 1 / sqrt(x). x [0, 1]. sign(x) sin(x) x. x < 0-1, x=0 0, 1. x. x > 0 sincos(x, out s, out c) sinh(x) smoothstep(min, max, x) sqrt(x) step(a, x) tan(x) tanh(x) transpose(m) x. sin(x) s, cos(x) c. x. x < min 0, x > max 1. [min, max] 0 1 smooth Hermite. ( ). (x = a)? 1 : 0. x. x. m. mro w s mc o lu m n s. mc o lu m n s mrow s 16. 4 (1D, 2D, 3D, ) 4 (,,, ) 16. tex1d(s, t) 1. s. t. tex1d(s, t, ddx, ddy) (LOD ) 1D. t, ddx, and ddy.. s tex1dproj(s, t) 1. s. t 4D. t t.w.

1. DirectX HLSL 47 tex1dbias(s, t) tex2d(s, t) tex2d(s, t, ddx, ddy) tex2dproj(s, t) tex2dbias(s, t) tex3d(s, t) tex3d(s, t, ddx, ddy) tex3dproj(s, t) tex3dbias(s, t) texcube(s, t) texcube(s, t, ddx, ddy) texcubeproj(s, t) texcubebias(s, t) (bias) 1. s. t 4D. (mip) t.w. 2D. s. t 2. (LOD ). s. t, ddx ddy 2. 2. s. t 4. t (t.w 1 ) t.w. 2. s. t 4. (mip) t.w. 3. s. t 3. (derivatives) 3. s. t, ddx, ddy 3. 3. s. t 4. t t.w. 3. s. t 4. (mip) t.w.. s. t 3.. s. t, ddx, ddy 3.. s, t 4D. t t.w.. s. t 4. (mip) t.w. t ex1d(), t ex2d(), t ex3d() t excube(). ddx ddy ddx(), ddy() LOD(level of detail)., ps_2_0. Tex*proj () (projective)..

t ex2dproj (), (Perspective Shadow map). Tex*bi as,. (over-blurred)., ShaderX 2 : DirectX 9 & Radeon 9700 Animusic Pipedream, t excubebi as ().... / /. f l oat 3 vcubelookup = vref l ect i on + i. Pos/ f EnvMapRadi us ; f l oat 4 cref l ect i on = t excubebi as (t CubeEnv, f l oat 4 (vcubelookup, f Bl ur * f Text urebl ur ) ) * vref l ect i oncol or ;... t excubebi as () t f l oat 4(vCubeLookup.x, vcube Lookup.y, vcubelookup.z, f Bl ur*ftext urebl ur ), f Bl ur*ftext urebl ur t.w t excubebi as (t excube() t.w ). DirectX 9 HLSL. varying uniform. varying. varying (, ). uniform (, ). uniform, varying v t.

1. DirectX HLSL 49 unifo rm uniform HLSL 2.. uniform. uniform. uniform.. / / uni f orm. / / Uni f ormgl obal. f l oat 4 Uni f ormgl obal ; / / uni f orm. / / ' $Uni f ormparam. f l oat 4 mai n( uni f orm f l oat 4 Uni f ormparam ) : POSITION ret ur n Uni f ormgl obal * Uni f ormparam; uniform. uniform. N o t e uniform $. $ (local variable) (global variable). uniform. ( )... API D3DX Effect.

fxc.exe. / / / / Generat ed by Mi crosof t (R) D3DX9 Shader Compi l er / / / / Source : hemi sphere.fx / / Fl ags : / E:VS /T:vs_1_1 / / / / Regi st er s : / / / / Name Reg Si ze / / - - - - - - - - - - - - - - - - - - - - - / / Proj ect i on c0 4 / / Wor l dvi ew c4 3 / / Di r FromLi ght c7 1 / / Di r FromSky c8 1 / / $bhemi c18 1 / / $bdi f f c19 1 / / $bspec c20 1 / / / / / / Def aul t val ues : / / / / Di r FromLi ght / / c7 = 0.577, -0.577, 0.577, 0 ; / / / / Di r FromSky / / c8 = 0, -1, 0, 0 ; va rying varing. uniform. uniform.

1. DirectX HLSL 51., POSITION0.. (,,,, ). D3DDECLUSAGE UsageIndex 1 1. (rasterization).... (:)..,.. / /. st r uct I nst ruct f l oat 4 Pos1 : POSITION1 ; / / Pos. f l oat 4 mai n( f l oat 4 Pos : POSITION0, I nst ruct I n ) : POSITION ret ur n Pos * I n. Pos1;

/ / COLOR0 Col. f l oat 4 mai nps( f l oat 4 Col : COLOR0 ) : COLOR ret ur n Col ;. POSITIONn BLENDWEIGHTn BLENDINDICESn NORMALn PSIZEn COLORn TEXCOORDn TANGENTn BINORMALn TESSFACTORn (.). COLORn TEXCOORDn n PSIZE0, DIFFUSE1...,

1. DirectX HLSL 53... POSITION. TEXCOORDn COLORn... DEPTH. N o t e DEPTH (MRT ).... POSITION PSIZE FOG COLORn TEXCOORDn ( : COLOR0) ( : TEXCOORD0). COLORn DEPTH n

n ( : TEXCOORD3, COLOR0). HLSL. / /. st r uct Out St ruct f l oat 2 Tex2 : TEXCOORD2 ; / / TEXCOORD0 Tex0 f l oat 4 mai n(out f l oat 2 Tex0 : TEXCOORD0, out Out St r uct Out ) : POSITION Tex0 = f l oat 2(1.0, 0.0) ; Out.Tex2 = f l oat 2 (0. 1, 0.2) ; ret ur n f l oat 4(0.5, 0.5, 0.5, 1) ; / / COLOR0 Col f l oat 4 mai nps( out f l oat 4 Col 1 : COLOR1) : COLOR / / 1. Col 1 = f l oat 4(0.0, 0.0, 0.0, 0.0) ; / / ret ur n 0. ret ur n f l oat 4(1.0, 0.9722, 0.3333334, 0) ; st r uct PS_OUT f l oat 4 Col or : COLOR; f l oat Dept h: DEPTH; ; / / / / / / PS_OUT PSFunc1( )... voi d PSFunc2 (out f l oat 4 Col or : COLOR, out f l oat Dept h : DEPTH)

[ 1. DirectX HLSL 55... voi d PSFunc3(out PS_OUT Out ).... NPR Metallic.. [ 1-2]. ATI Developer Relations (http://www.ati.com/developer). 1-2 ] NP RMe ta llic, HLSL NPR Metallic.

f l oat 4x4 vi ew_proj_mat r i x; f l oat 4 vi ew_posi t i on; f l oat 4 l i ght 0; f l oat 4 l i ght 1; f l oat 4 l i ght 2; st r uct VS_OUTPUT f l oat 4 Pos : POSITION; f l oat 3 Vi ew : TEXCOORD0; f l oat 3 Normal : TEXCOORD1; f l oat 3 Li ght 1 : TEXCOORD2 ; f l oat 3 Li ght 2 : TEXCOORD3; f l oat 3 Li ght 3 : TEXCOORD4 ; ; VS_OUTPUT mai n(f l oat 4 i npos : POSITION, f l oat 3 i nnorm : NORMAL) VS_OUTPUT Out = (VS_OUTPUT) 0; / /. Out. Pos = mul (vi ew_proj_mat r i x, i npos ) ; Out.Normal = i nnorm; / /. Out.Vi ew = normal i ze (vi ew_posi t i on - i npos ) ; / /. Out. Li ght 1 = normal i ze (l i ght 0 - i npos ) ; / / 1 Out. Li ght 2 = normal i ze (l i ght 1 - i npos ) ; / / 2 Out. Li ght 3 = normal i ze (l i ght 2 - i npos ) ; / / 3 ret ur n Out ; vi ew_proj_mat ri x, vi ew_posi t i on, l i ght 0, l i ght 1, l i ght 2. API,.

1. DirectX HLSL 57 mai n VS_OUTPUT, 4D 5 3D., 4D, 3D 2D. i npos mul () vi ew_proj_mat r i x, i nnorm., 3D. 3D normal i ze (). 3D 3D,.,. NPRMetallic.vhl,. f xc -nol ogo -T vs_1_1 -Fc -Vd NPRMet al l i c.vhl vs_1_1.,.. / / Paramet ers : / / f l oat 4 l i ght 0; / / f l oat 4 l i ght 1; / / f l oat 4 l i ght 2 ; / / f l oat 4 vi ew_posi t i on; / / f l oat 4x4 vi ew_proj_mat ri x; / / / / Regi st er s : / / Name Reg Si ze / / - - - - - - - - - - - - - - - - - - - - - - - - - / / vi ew_proj_mat r i xc0 4 / / vi ew_posi t i on c4 1

/ / l i ght 1 c5 1 / / l i ght 2 c6 1 / / l i ght 0 c7 1 vs_1_1 dcl _posi t i on v0 dcl _normal v1 mul r0, v0. x, c0 mad r2, v0.y, c1, r0 mad r4, v0. z, c2, r2 mad opos, v0.w, c3, r4 add r 1, -v0, c4 dp4 r 1.w, r 1, r 1 rsq r1.w, r1.w mul ot0. xyz, r 1, r 1.w add r8, -v0, c7 dp4 r8.w, r8, r8 rsq r8.w, r8.w mul ot2. xyz, r8, r8.w add r3, -v0, c5 add r 10, -v0, c6 dp4 r3.w, r3, r3 rsq r3.w, r3.w mul ot3. xyz, r3, r3.w dp4 r 10.w, r 10, r 10 rsq r 10.w, r 10.w mul ot4.xyz, r 10, r10.w mov ot1. xyz, v1. API. 21., mai n POSITION NORMAL dcl_posi t i on dcl_normal. opos, ot0, ot1, ot2, ot3 ot4.., HLSL fxc.

1. DirectX HLSL 59.. NPR Metallic. f l oat 4 Mat eri al ; sampl er Out l i ne ; f l oat 4 mai n(f l oat 3 Vi ew: TEXCOORD0, f l oat 3 Normal : TEXCOORD1, f l oat 3 Li ght 1: TEXCOORD2, f l oat 3 Li ght 2 : TEXCOORD3, f l oat 3 Li ght 3 : TEXCOORD4 ) : COLOR / / f l oat 3 norm = normal i ze (Normal ) ; f l oat 4 out l i ne = t ex1d(out l i ne, 1 - dot (norm, normal i ze (Vi ew) ) ) ; f l oat l i ght i ng = (dot (normal i ze (Li ght 1), norm) * 0.5 + 0.5) + (dot (normal i ze (Li ght 2), norm) * 0.5 + 0.5) + (dot (normal i ze (Li ght 3), norm) * 0.5 + 0.5) ; ret ur n out l i ne * Mat er i al * l i ght i ng;. 4D Mat er i al, Out l i ne. 3D mai n,,, 3,. normal i ze ()...

out l i ne * Mat eri al * l i ght i ng. 4D,.,.. ret ur n out l i ne * Mat er i al * l i ght i ng; ret ur n out l i ne * Mat er i al * f l oat 4 (l i ght i ng, l i ght i ng, l i ght i ng, l i ght i ng) ; l i ght i ng, [ 1-2]. NPR Metallic. f xc -nol ogo -T ps_2_0 -Fc -Vd NPRMet al l i c. phl ps_2_0.. / / / / f l oat 4 Mat eri al ; / / sampl er Out l i ne ; / / / / / / Name Reg Si ze / / - - - - - - - - - - - - - - - - - - - - / / Mat er i al c0 1 / / Out l i ne s0 1 ps_2_0 def c1, 1, 0, 0, 0.5 dcl t 0.xyz dcl t 1.xyz dcl t 2.xyz dcl t 3.xyz dcl t 4.xyz dcl_2d s0

1. DirectX HLSL 61 dp3 r0.w, t 1, t 1 r sq r2.w, r0.w mul r9.xyz, r2.w, t 1 dp3 r9.w, t 0, t 0 r sq r9.w, r9.w mul r4.xyz, r9.w, t 0 dp3 r9.w, r9, r4 add r 11.xy, - r9.w, c1.x t exl d r6, r 11, s0 dp3 r9.w, t 2, t 2 r sq r9.w, r9.w mul r1. xyz, r9.w, t 2 dp3 r9.w, r 1, r9 mad r9.w, r9.w, c1.w, c1.w dp3 r8.w, t 3, t 3 r sq r 10.w, r8.w mul r5.xyz, r 10.w, t 3 dp3 r0.w, r5, r9 mad r9.w, r0.w, c1.w, r9.w add r9.w, r9.w, c1.w dp3 r2.w, t 4, t 4 r sq r 11.w, r2.w mul r1. xyz, r11.w, t 4 dp3 r8.w, r 1, r9 mad r 10.w, r8.w, c1.w, r9.w add r5.w, r 10.w, c1.w mul r6, r6, r5.w mul r0, r6, c0 mov oc0, r0 ( Mat eri al, Out l i ne). API ps_2_0 def. def ALU. HLSL NPR Metallic.

... 1 - dot (norm, normal i ze (Vi ew)... dot (normal i ze (Li ght 1), norm) * 0.5 + 0.5... dcl t n.xyz 3D. HLSL mai n. dc1_2d s0. 0 2D. HLSL t ex1d. Direct3D API 1D. t ex1d() HLSL. HLSL. HLSL. DirectX HLSL, HLSL., HLSL 1.x.,.,.,.. HLSL

1. DirectX HLSL 63. nx1, t ex2d() HLSL.,.,... uniform ( )...,.. HLSL C.,.. ( a b a b. a float4(b,b,b,b)), HLSL.,..

.,. HLSL i nt. i nt. i nt. f l oat. 2.5 float4 4 2 2 2 3. f l oat s. C. i nt. i nt. i nt. i nt,. i nt. f l oat i nt float. i nt i nt. int f l oat. Out Pos = mul (Pos, Wor l dar ray[i ndex] ) ; / / f l oat / / i nt f rc r0.w, r 1.w mul r0.w, c60.x, r 1.w f rc r0.w, r 1.w mul r0.w, c60.x, r 1.w

1. DirectX HLSL 65 add r2.w, - r0.w, r1.w mova a0.x, r0.w mul r9.w, r2.w, c61. x m4x4 opos, v0, c0[a0. x] mova a0.x, r9.w m4x4 opos, v0, c0[a0.x].. ( (static branching), (predicated instructions), (static looping), (dynamic branching), (dynamic looping)). HLSL,., HLSL,..,..,. Ps_1_1 DirectX 9 SDK DepthOfField.,. If. if,. CPU, HLSL. CPU,. predicated~instructions, static~if~blocks dynamic~if~blocks.

vs_1_1, i f (Val ue > 0) Posi t i on = Val ue1; el se Posi t i on = Val ue2 ;, / / Val ue>0 l er p. mov r 1.w, c2.x sl t r0.w, c3.x, r 1.w / / Val ue1 Val ue2 l er p. mov r7, -c1 add r2, r7, c0 mad opos, r0.w, r2, c1 /.. draw /,., draw... CPU.. CPU.,. CPU.

1. DirectX HLSL 67., Direct3D. 4 f l oat (, x, y, z.),. f l oat 4., w w, 1.0. y z, 0.0.. w 1.0, x, y, z. f l oat 3 w 1.0. f l oat 4 1.0...,, i nt f l oat. i nt i nt.. (lo g p, e xp p, lit).,., ps_1_x

.. vs_1_1 vs_2_0. l ogp, expp l i t l og, exp pow.. l og exp 10, l ogp, expp. vs_1_1. hal f... l og l ogp. f l oat LogVal ue = l og(val ue ) ; f l oat LogVal ue = (hal f )l og(val ue ) / / vs_1_1 / / vs_1_1 / / 10. / / 1. l og r0, c0; l ogp r0, c0 ps_ 1_x (ps_1_1, ps_1_2, ps1_3, ps_1_4). HLSL ps_1_x,., ps_1_x. Ps_1_x..

1. DirectX HLSL 69. Ps_1_1 ps_1_3 (. r,.g,.b,.a). Ps_1_4.. ps_1_x HLSL. Ps_1_x source dest 0 1 source.... HLSL. sat urat e () _sat. _ bx2 _bx2 HLSL HLSL. mai n _bx2. f l oat 4 mai n( f l oat 3 Col : COLOR0, f l oat 3 Tex : TEXCOORD0 ) : COLOR0 ret ur n dot (Col, Tex*2-1) ; f l oat 4 mai n( f l oat 3 Col : COLOR0, f l oat 3 Tex : TEXCOORD0 ) : COLOR0 f l oat 3 val = Tex*2 ; val = val -1; ret ur n dot (Col, val ) ; f l oat 4 mai n( f l oat 3 Col : COLOR0, f l oat 3 Tex : TEXCOORD0 ) : COLOR0 ret ur n dot (Col, (Tex -.5f )*2) ;

ps_1_x. ps_1_1 t excoord t 0 dp3 r0, v0, t 0_bx2 Tex*2-1 ps_2_0. _ bias _bi as. f l oat 4 mai n( f l oat 3 Col : COLOR0, f l oat 3 Tex : TEXCOORD0 ) : COLOR0 ret ur n dot (Col, (Tex -.5f ) ) ; mai n. ps_1_1 t excoord t 0 dp3 r0, v0, t 0_bi as _bi as 0 1, ps_1_1, ps_1_2, ps_1_3.. _ x2 (ps_ 1_ 4 only) _x2. f l oat 4 mai n( f l oat 3 Col : COLOR0, f l oat 3 Tex : TEXCOORD0 ) : COLOR0 ret ur n dot (Col, Tex*2) ; HLSL.

1. DirectX HLSL 71 ps_1_4 t excrd r0.xyz, t 0 dp3 r0, v0, r0_x2 _ x2, _ x4, _ x8, _ d2, _ d4 _ d8 destination write destination write ps_1_x, HLSL. (_x2) (_x4) (_d2) ps_1_1 ps_1_3 ps_1_4 6 (_x2, _x4, _x8, _d2, _d4, _d8 ). N 2, 4, 8, 0.5, 0.25, 0.125. st at i c const f l oat N = 2; f l oat 4 mai n( f l oat 4 Col [2] : COLOR0 ) : COLOR0 ret ur n (Col [0] + Col [1] )*N; HLSL. ps_1_1 add_x2 r0, v0, v1 complement ( ) ps_1_x HLSL complement. 0 1. HLSL. f l oat 4 mai n( f l oat 4 Col [2] : COLOR0 ) : COLOR0 ret ur n (1-Col [0] ) * (Col [1] ) ;

HLSL. ps_1_1 mul r0, 1-v0, v1 saturate ( ) _sat.. f l oat 4 mai n( f l oat 4 Col [2] : COLOR0 ) : COLOR0 ret ur n sat urat e (Col [0] ) ; f l oat 4 mai n( f l oat 4 Col [2] : COLOR0 ) : COLOR0 ret ur n cl amp(col [0], 0, 1) ; HLSL. ps_1_1 mov_sat r0, v0 negate ( ) negate. N o t e PS_1_x negate, negate. f l oat 4 mai n( f l oat 4 Col [2] : COLOR0 ) : COLOR0 ret ur n -Col [0] ;

1. DirectX HLSL 73 HLSL. ps_1_1 mov r0, -v0 ps_ 1_x ps_1_x ps_2_0. ps_2_0, ps_1_x. Fxc.exe, ps_1_x. ps_1_x. HLSL, HLSL. HLSL D3DX Effect, Effect. HLSL,. D3DX Effe c t D3DX D3DX Effect DirectX 9 D3DX Effect HLSL. D3DX Effect 3. Effect (Rendering state) HLSL asm. Effect.fx.fxl, techniques Effect. Effect

. techniques DirectX SDK Water... Effe c t Effect, HLSL Effect. Effect. / / VECTOR g_leye ; f l oat 4 Gl obalambi ent = 0.5; f l oat Ka = 1; f l oat Kd = 0.8; f l oat Ks = 0.9; f l oat roughness = 0. 1; f l oat noi sefrequency; MATRIX mat Worl dvi ewproj ; MATRIX mat Worl dvi ew; MATRIX mat ITWor l dvi ew; MATRIX mat Worl d; MATRIX mat Tex0; TEXTURE t Vol umenoi se ; TEXTURE t Mar bl espl i ne ; sampl er Noi sesampl er = sampl er_st at e Text ure = (t Vol umenoi se ) ; Mi nfi l t er = Li near ; MagFi l t er = Li near ; Mi pfi l t er = Li near ; AddressU = Wrap; AddressV = Wrap; AddressW = Wrap; MaxAni sot ropy = 16; ;

1. DirectX HLSL 75 sampl er Mar bl espl i nesampl er = sampl er_st at e Text ure = (t Marbl espl i ne ) ; Mi nfi l t er = Li near ; MagFi l t er = Li near ; Mi pfi l t er = Li near ; AddressU = Cl amp; AddressV = Cl amp; MaxAni sot ropy = 16; ; f l oat 3 snoi se (f l oat 3 x) ret ur n 2.0f * t ex3d (Noi sesampl er, x) - 1.0f ; f l oat 4 ambi ent (voi d) ret ur n Gl obal Ambi ent ; f l oat 4 sof t _di f f use (f l oat 3 Neye, f l oat 3 Peye ) / / (Leye ). f l oat 3 Leye = (g_leye - Peye ) / l engt h(g_leye - Peye ) ; f l oat Ndot L = dot (Neye, Leye ) * 0.5f + 0.5f ; / / N. L ret ur n f l oat 4 (Ndot L, Ndot L, Ndot L, Ndot L) ; f l oat 4 specul ar (f l oat 3 NNeye, f l oat 3 Peye, f l oat k) / / (Leye ). f l oat 3 Leye = (g_leye - Peye ) / l engt h(g_leye - Peye ) ; / / Veye. f l oat 3 Veye = - (Peye / l engt h(peye ) ) ;

/ / hal f -angl e. f l oat 3 Heye = (Leye + Veye ) / l engt h(leye + Veye ) ; / / N.H. f l oat Ndot H = cl amp(dot (NNeye, Heye ), 0.0f, 1.0f ) ; f l oat Ndot H_2 = Ndot H * Ndot H; f l oat Ndot H_4 = Ndot H_2 * Ndot H_2 ; f l oat Ndot H_8 = Ndot H_4 * Ndot H_4 ; f l oat Ndot H_16 = Ndot H_8 * Ndot H_8; f l oat Ndot H_32 = Ndot H_16 * Ndot H_16; ret ur n Ndot H_32 * Ndot H_32 ; f l oat 4 hl sl _bl uemarbl e (f l oat 3 P : TEXCOORD0, f l oat 3 Peye : TEXCOORD1, f l oat 3 Neye : TEXCOORD2) : COLOR f l oat 4 Ct ; f l oat 4 Ci ; f l oat 3 NNeye ; f l oat mar bl e ; f l oat f ; / /. P = P/ 16; mar bl e = -2.0f * snoi se (P * noi sefrequency) + 0.75f ; NNeye = normal i ze (Neye) ; / / ( ) f. Ct = t ex1d (Mar bl espl i nesampl er, mar bl e ) ; / / Ci = Ct * (Ka * ambi ent ( ) + Kd * sof t _di f f use (NNeye, Peye ) ) + Ct.w * Ks * specul ar (NNeye, Peye, roughness ) ; ret ur n Ci ;

1. DirectX HLSL 77 VERTEXSHADER asm_mar bl e_vs = decl asm vs.1. 1 dcl_posi t i on v0 dcl_normal v3 m4x4 opos, v0, c [0] m4x4 r0, v0, c [17] mov ot0, r0 m4x4 ot1, v0, c [4] m3x3 ot2.xyz, v3, c [8] ; / /. / / Pshade (0 ) / / / / t echni que t echni que_hl sl_bl uemar bl e pass P0 / / / /. Vert exshaderconst ant [0] = <mat Wor l dvi ewproj >; Vert exshaderconst ant [4] = <mat Wor l dvi ew>; Vert exshaderconst ant [8] = <mat ITWorl dvi ew>; Vert exshaderconst ant [12] = <mat Wor l d>; Vert exshaderconst ant [17] = <mat Tex0>; Vert exshader = <asm_marbl e_vs>; Pi xel Shader = compi l e ps_2_0 hl sl _bl uemarbl e ( ) ; Cul l Mode = CCW;. Effect t echni que_hl sl _bl uemarbl e technique. HLSL., Effect ( ID3DEf f ect : :Set Mat ri x()

). Effect. HLSL. ams_marbl e_vs. Vert exshader = <asm_marbl e_vs>; hl sl _bl uemarbl e () ps_2_0. Pi xel Shader = compi l e ps_2_0 hl sl _bl uemar bl e ( ) ; hl sl_bl uemarl be HLSL. t ex1d(), ambi ent () sof t _di f f use () Effect. ps_2_0., Noi sesampl er Marbl espl i nesampl er. Effect,. Effect. Effect. Effe c t API Effect.. D3DXCreat eef f ect FromFi l e () API Effect, Effect Effect API., Set Mat r i x().

1. DirectX HLSL 79 / /. m_pef f ect ->Set Mat ri x ( "mat Wor l dvi ewproj ", &m_mat Wor l dvi ewproj ) ; m_pef f ect ->Set Mat ri x ( "mat Wor l dvi ew", &m_mat Wor l dvi ew) ; m_pef f ect ->Set Mat ri x ( "mat ITWor l dvi ew", &m_mat ITWor l dvi ew) ; m_pef f ect ->Set Mat ri x ( "mat Wor l d", &m_mat Wor l d) ; m_pef f ect ->Set Mat ri x ( "mat Tex0", &m_obj ect Paramet er s.m_mat Tex0) ; f l oat vect or. m_peffect ->Set Fl oat ( "noi sefrequency ", &m_f Noi sefreq) ; m_pef f ect ->Set Vect or ( "g_leye ", &g_leye ) ;. m_pef f ect ->Set Text ure ( "t Vol umenoi se ", m_pvol umenoi setext ure) ; m_pef f ect ->Set Text ure ( "t Mar bl espl i ne ", m_pmar bl ecol orspl i netext ure) ;, technique ( ). m_pef f ect ->Set Techni que (m_pef f ect ->Get Techni quebyname ( "t echni que_hl sl _ bl uemar bl e ") ) ; m_peffect ->Begi n(&cpasses, 0) ; f or (i Pass = 0; i Pass < cpasses ; i Pass++) m_pef f ect ->Pass (i Pass ) ; / /. m_pef f ect ->End( ) ;., g_leye,. D3DX Effect.

D3DX Effe c t ISV D3DX. HLSL D3DX Effect. D3DX.. HLSL D3DX Effect HLSL. D3DXAssembl eshader*() D3DXCompi l eshader*(). asm, Creat epi xel Shader () Creat evert exshader ().. i f (FAI LED (hr = D3DXCompi l eshader FromFi l e (g_st rvhlfi l e, NULL, NULL, "mai n", "vs_1_1", NULL, &pcode, NULL, &m_vs_const ant Tabl e) ) ) ret ur n hr ; i f (FAI LED (hr = m_pd3ddevi ce ->Creat evert exshader ( (DWORD*)pCode -> Get Buf f er Poi nt er ( ), &m_hlslvert exshader ) ) ) ret ur n hr ; D3DXCompi l eshader *() D3DXAssembl eshader*(). ( mai n vs_1_1 )., #def i nes,,,,,. D3DXCompi l eshader*(). (,, ).

1. DirectX HLSL 81 HLSL, Creat epi xel Shader () Creat evert exshader (). Effect HLSL, D3DXCompi l eshader*(). D3DXCompi l eshader*()... ID3DXConst ant Tabl e. ID3DXConst ant Tabl e ASCII handle. HLSL. D3DXHANDLE handl e ; i f (handl e = m_ps_const ant Tabl e ->Get Const ant ByName (NULL, "r i ngfreq") ) m_ps_const ant Tabl e ->Set Fl oat (m_pd3ddevi ce, handl e, m_f Ri ngfrequency) ; i f (handl e = m_ps_const ant Tabl e ->Get Const ant ByName (NULL, "l i ght Wood") ) m_ps_const ant Tabl e ->Set Vect or (m_pd3ddevi ce, handl e, &l i ght Wood) ;. i f (handl e = m_ps_const ant Tabl e ->Get Const ant ByName (NULL, "Noi sesampl er ") ) m_ps_const ant Tabl e ->Get Const ant Desc (handl e, &const Desc, &count ) ;

i f (const Desc.Regi st erset == D3DXRS_SAMPLER) m_pd3ddevi ce ->Set Text ure (const Desc.Regi st er I ndex, m_pvol umenoi setext ure) ; / / Noi se. m_pd3ddevi ce ->Set Sampl erst at e (const Desc.Regi st eri ndex,, ) ;, D3DX Effect HLSL.,. ID3DXConst ant Tabl e : :Get Desc (). ID3DXConst ant Tabl e : :Get Const ant ByName () ID3DXConst ant Tabl e : :Get Const ant El ement (). D3DX Effect HLSL ID3DXConst ant Tabl e. SDK DX9.0 DirectX 9.0a, SDK. SDK Direct3D, HLSL D3DX. DirectX SDK asm.

1. DirectX HLSL 83 DirectX 9.0 Direct3D High Level Shading Language(HLSL).,.,. HLSL, HLSL. HLSL ATI 3D Application Research Group. Dan Baker Loren McQuade. Mark Wang Wolfgang.