- 1、本文档共83页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
LightingandSolidModeling
Lighting Models CIS 488/588 Bruce R. Maxim UM-Dearborn Lighting Huge topic in computer graphics Nearly all 3D rendering packages make use of ray tracing to determine the shadows and reflective surfaces in the screen images Software-based graphics engines cannot support the same complex lighting models that hardware (e.g. pixel and vertex shaders) Color Models Color can be represented using separate RGB values or using an index into a table Some RGB models use integers 0-255 for each color and some use real numbers with values 0.0-1.0 for each Float values are easier to work with mathematically, but integers can be faster for rendering since they can be written straight to the video buffer Color Addition When adding two RGB integer colors you need to catch overflow problems C1 = (r1, g1, b1) C2 = (r2, g2, b2) C = C1 + C2 C = (max(r1 + r2, 255), max(r1 + r2, 255), max(r1 + r2, 255)) Color Modulation Color modulation is basically multiplication Can be done using a real scalar (brightness modulation) or by multiplying the RGB values in a pairwise manner C1 = (r1, g1, b1) C2 = (r2, g2, b2) C = s * C1 = (s * r1, s *g1, s * b1) C = C1 * C2 = (r1 * r2, g1 * g2, b1 * b2) Again, we need to beware of overflow Demo8_1 // copy texture into temp for rendering and scaling Copy_Bitmap(temp_text,0,0, textures[curr_texture],0,0,TEXTSIZE, TEXTSIZE); ? /////////////////////////////////////////// // our little image processing algorithm :) //Cmodulated = s*C1 = (s*r1, s*g1, s*b1) ? USHORT *pbuffer = (USHORT *)temp_text.buffer; ? Demo8_1 // perform RGB transformation on bitmap for (int iy = 0; iy temp_text.height; iy++) for (int ix = 0; ix temp_text.width; ix++) { USHORT pixel = pbuffer[iy*temp_text.width + ix]; int ri,gi,bi; // used to extract the rgb values _RGB565FROM16BIT(pixel, ri,gi,bi); // perform scaling operation and test for overflow if ((ri = (float)ri * scalef) 255) ri=255; if ((gi = (float)gi * scalef) 255) gi=25
您可能关注的文档
最近下载
- 减震器说明书.doc
- 饮料浓浆 团体标准.docx VIP
- 必威体育精装版中小学教师高级职称晋升初中语文学科讲课答辩真题汇编(附答案详解).pdf
- 电解质饮料 团体标准.docx VIP
- 东风雪铁龙C5汽车使用手册用户说明书pdf电子版下载.pdf
- CVP监测危重患者液体管理.ppt VIP
- 六年级数学分数混合运算专项练习题.pdf VIP
- 小学二年级上册道德与法制 道法 备课 学历案.docx VIP
- 基于“双高”背景下高职院校一流师资队伍建设的思考-来源:现代职业教育(高职高专)(第2020030期)-山西教育教辅传媒集团有限责任公司.pdf VIP
- 第二届全国数字化机房安装技能竞赛(电气设备安装工赛项)考试题库资料-下(多选、判断题汇总).pdf
文档评论(0)