תאורה ב-OpenGL

החצרן

New member
תאורה ב-OpenGL

אני מנסה לבנות את מערכת השמש באופן שמהמרכז יהיה אור דיפיוזי (ולא אמביאנטי) שיאיר בצורת מעגל. כך שבזמן שכדור הארץ יסתובב סביבו - רק הצד הפונה למרכז יואר. מישהו יודע איך עושים את זה??? תודה מראש, יקי
 

erezsh

New member
זה פשוט למדי

קרא על תאורה בכל Tutorial בסיסי. בכל מקרה, אני ממליץ לך לקרוא את The Red Book של OpenGL. יש בו הסברים מעמיקים, טובים ומפורטים.
 

החצרן

New member
אז פשוט אמור לי איך!

שאלתי את השאלה הזו אחרי שעשיתי עשרות נסיונות שונים ע"פ כל מיני מדריכים ועדיין לא הצלחתי ליצר אור המאיר ל-360 מעלות ומדמה שמש, באופן שאני יכול לסובב כדור-ארץ סביבו. לכן, פשוט אמור לי איך, בבקשה!
 

ZDanielZ

New member
ניסית להציץ פה?

כלומר פה. מה בדיוק לא פועל לך? יש לך קוד להראות לנו? הקוד שיש בלינק אמור לפתור לך את כל הבעיה, אם לא, ההימור שלי שאתה שם נורמלים לא נכונים, או ששמת את האור במקום לא נכון, או לא הדלקת תאורה. תציץ בלינק, ותראה אם זה עוזר לך. בהצלחה.
 

החצרן

New member
הבעיה היא TEXTURE

לקחתי תכנית שמממשת TEXTURE של כדור הארץ (ע"י ציור BMP) ומסיבה לא ברורה לי כאשני ממקם את התאורה במרכז תמיד הכדור מואר באופן אחיד, גם כאשר ישנם כדורים רגילים (Sphere) מסביב המואר רק בצד הפונה למרכז. האם מישהו יודע כיצד לפתור את זה??? או, האם יש למישהו מימוש של TEXTURE לכדור שלא עושה כזו בעיה???
 

erezsh

New member
האם

אתה מגדיר את הנורמלים? ומשתמש בחוזק מתאים של תאורה?
 

Oneros

New member
Check materials and normal

try enabling GL_AUTO_NORMAL with: glEnable(GL_AUTO_NORMAL); if you can't see the effect of the lights at all, i'd recommend setting a material to the textured sphere. start with extreme cases, light that is white and materials that reflect only red, green or blue. do you have a code you can attach?
 

the another one

New member
תודה !

לא, אין לי קוד ספציפי עם בעיות, פשוט רציתי לדעת אם יש אפשרות לאור גלובלי שיגיע לכל המרחב....
 

Oneros

New member
Few thoughts

i think there is some mixing in your definitions, ambient and diffuse (or specular, not to leave it out) are how lights effect surfaces or materials. what type of light source are you using? you need a light source that goes in all directions, which is a point light. your direction should be all, which means that the 4th coordinate, the last homogenous coordinate - a.k.a w, of the direction is 0.0 and the position is somewhere in your space, therefore the fourth coordinate of the position is 1.0, unlike directional light that has no position hence zero w tell me if that helps. and by the way, you can find free copy of the red book (legal) in pdf format on the web. it has great section about lights and worth a read, try also searching for the physics of lights and how they are used in CGI
 
למעלה