Spalvos ir apvietimas - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Spalvos ir apvietimas

Description:

Skirtumas tarp iu 2 sistemu RGB reaguoja i ap vietimo ( viesos),o CMY i objekto spalva. ... from light that has bounced off other surfaces. ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 13
Provided by: talp7
Category:

less

Transcript and Presenter's Notes

Title: Spalvos ir apvietimas


1
Spalvos ir apvietimas
  • Ingrida Maonaviciute
  • GRAFINIU SISTEMU KATEDRA

2
RGB vs. CMY
SUDEDAMA
ATIMAMA
  • Skirtumas tarp iu 2 sistemu RGB reaguoja i
    apvietimo (viesos),o CMY i objekto spalva.
  • Monitoriuose, o yuo paciu ir DirectX naudojama
    RGB, o spausdintuvuose - CMY
  • http//www.byronc.com/art_color.shtml

3
Spalvos aprayma sudarantys kanalai
D3DCOLOR (0xff00ff00) D3DCOLOR_ARGB(136, 255, 0,
204) D3DCOLOR_XRGB(0, 255, 0)
4
Spalvinimas - shading
  • eeliavimas susietas su rasterizavimu (objekto
    nagrinejimu pikseliais) ir nurodo, kaip viruniu
    spalvos panaudojamos pikseliams apskaiciuoti.

Egzistuoja 1. FLAT shading (With flat shading,
the pixels of a primitive are uniformly colored
by the color specified in the first vertex of the
primitive. So the triangle formed by the
following three vertices would be red, since the
first vertex color is red. The colors of the
second and third vertices are ignored with flat
shading.) 2. GOUROUD (smooth) shading (With
Gouraud shading, the colors at each vertex are
interpolated linearly across the face of the
primitive.)
5
FLAT vs. GOUROUD
6
Lightning (apvietimas)
Naudojant apvietima, Direct3D perleidia
kiekviena virune pro apvietimo varikli, ir
virunes spalva apskaiciuojama pagal viesos
altinio spalva, mediaga i kurios padarytas
kunas ir paviriaus saryi su viesos altinio
objektu.
3 viesos komponentu ruys
Diffuse Light
Ambient Light
Specular Light
Device-gtSetRenderState(D3DRS_SPECULARENABLE,
true)
7
Diffuse Light
viesa viecia i objekta netiesiogiai.
  • Diffuse Light This type of light travels in a
    particular direction. When it strikes a surface,
    it reflects equally in all directions.
  • Because diffuse light reflects equally in
    all directions, the reflected light will reach
    the eye no matter the viewpoint, and therefore we
    do not need to take the viewer into
    consideration. Thus, the diffuse 98 lighting
    equation needs only to consider the light
    direction and the attitude of the surface. This
    kind of light will be your general light that
    emits from a source.

8
Ambient Light
Neturi viesos altinio, atsiranda
atsispindejimas nuo kitu objektu
Ambient Lighting
  • Ambient Light This kind of light models light
    that has reflected off other surfaces and is used
    to brighten up the overall scene. For example,
    parts of objects are often lit, to a degree, even
    though they are not in direct sight of a light
    source. These parts get lit
  • from light that has bounced off other
    surfaces. Ambient light is a hack used to
    roughly, and cheaply, model this reflected light.

9
Specular Light
Tiesiogiai viecia i objekta atspindincia spalva
Specular Lighting
  • Specular Light This type of light travels in a
    particular direction. When it strikes a surface,
    it reflects harshly in one direction, causing a
    bright shine that can only be seen from some
    angles. Since the light reflects in one
    direction, clearly the viewpoint, in addition to
    the light direction and surface attitude, must be
    taken into consideration in the specular lighting
    equation. Specular light is used to model light
    that produces highlights on objects, such as the
    bright shine created when light strikes a
    polished surface.

10
Materials - mediagos
  • typedef struct _D3DMATERIAL9
  • D3DCOLORVALUE Diffuse, Ambient, Specular,
    Emissive
  • float Power
  • D3DMATERIAL9

EmissiveThis component is used to add to the
overall color of the surface, making it appear
brighter like its giving off its
own light. PowerSpecifies the sharpness of
specular highlights the higher this value, the
sharper the highlights
11
(No Transcript)
12
VOID SetupLights() // Set up a material.
The material here just has the diffuse and
ambient // colors set to yellow. Note that
only one material can be used at a time.
D3DMATERIAL9 mtrl ZeroMemory( mtrl,
sizeof(D3DMATERIAL9) ) mtrl.Diffuse.r
mtrl.Ambient.r 1.0f mtrl.Diffuse.g
mtrl.Ambient.g 1.0f mtrl.Diffuse.b
mtrl.Ambient.b 0.0f mtrl.Diffuse.a
mtrl.Ambient.a 1.0f g_pd3dDevice-gtSetMateri
al( mtrl ) // Set up a white, directional
light, with an oscillating direction. // Note
that many lights may be active at a time (but
each one slows down // the rendering of our
scene). However, here we are just using one.
Also, // we need to set the D3DRS_LIGHTING
renderstate to enable lighting D3DXVECTOR3
vecDir D3DLIGHT9 light ZeroMemory(
light, sizeof(D3DLIGHT9) ) light.Type
D3DLIGHT_DIRECTIONAL light.Diffuse.r
1.0f light.Diffuse.g 1.0f
light.Diffuse.b 1.0f vecDir
D3DXVECTOR3(cosf(timeGetTime()/350.0f),
1.0f,
sinf(timeGetTime()/350.0f) )
D3DXVec3Normalize( (D3DXVECTOR3)light.Direction,
vecDir ) light.Range 1000.0f
g_pd3dDevice-gtSetLight( 0, light )
g_pd3dDevice-gtLightEnable( 0, TRUE )
g_pd3dDevice-gtSetRenderState( D3DRS_LIGHTING,
TRUE ) // Finally, turn on some ambient
light. g_pd3dDevice-gtSetRenderState(
D3DRS_AMBIENT, 0x00202020 )
Write a Comment
User Comments (0)
About PowerShow.com