Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright  1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may.

Similar presentations


Presentation on theme: "Copyright  1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may."— Presentation transcript:

1 Copyright  1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the author. CS 497: Computer Graphics James Money

2 Copyright  1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the author. Multiple Light Sources Now how many times have you entered a room illuminated by a single light bulb? We need to account for multiple light sources, so for M light sources:

3 Copyright  1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the author. Multiple Light Sources There is one possibility now that I will exceed the maximum value of a pixel, on Windows 95/NT, 255. The way we will resolve the problem is clamp the maximum of I to 255.

4 Copyright  1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the author. Constant Shading Now how are we going to shade each polygon? Do we evaluate each pixel value separately? Unfortunately, this is the correct way, but it would take too long to compute. Our first approach is to find the pixel value for one vertex and use that for the entire polygon.

5 Copyright  1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the author. Constant Shading Believe it or not, constant shading is valid only if this is true: –The light source is at infinity. –The viewer is at infinity. –The polygon represents the actual surface, and not an approximation to one. If the first two are wrong, then we cannot use a single point on the polygon for constant shading.

6 Copyright  1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the author. Interpolated Shading Instead of flat shading, we could use interpolated shading. It works as such: –We evaluate the illumination equations at each vertex(n times), using the same normal each time. –Then, when we fill, we interpolate the I values along the edges in the 2D polygon filler, much as we have done  x for each y increment. –We also increment by some change in I along x for each value of I.

7 Copyright  1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the author. Interpolated Shading So with each edge in our filler we have now: –Ymin –Ymax –X - the X coordinate of point with Ymin –1/m or the X increment –Imin(RGB value) –deltaI(RGB value)

8 Copyright  1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the author. Interpolated Shading Repeat until Y=max Y of polygon(or until AET and ET are empty). –Move from ET to AET any edge whose Ymin=y. –Remove from AET any edge whose entry has y=Ymax. Sort AET on increasing X. –Fill in pixels using pairs of X coordinates on line y, starting with Imin pixel value on edge 1 incrementing by: (edge2->Imin-edge->Imin)/(edge2->x-edge->x) –Increment y by 1. –Add 1/m to x for each active edge. –Add deltaI to Imin each active edge.


Download ppt "Copyright  1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may."

Similar presentations


Ads by Google