Đang chuẩn bị liên kết để tải về tài liệu:
Focus On 3D Terrain Programming phần 4
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Lỗi hình thành các công trình lớn cho một cảnh ít tốt đẹp bao gồm của một số ngọn đồi nhỏ, nhưng điều gì sẽ xảy ra nếu bạn muốn một cái gì đó hỗn loạn hơn, chẳng hạn như một dãy núi thì sao? Vâng, không nhìn xa hơn. Điểm giữa displacement2 là câu trả lời mà bạn đang tìm kiếm! | This page intentionally left blank Team-Fly rtl ị 1 z 0 z n I m iữ Texturing terrain brought about a new level of detail into our terrain and lighting terrain will bring a whole new level of realism. The question is this How do we light our terrain as quickly as possible while still keeping a high level of realism Well all the techniques that I will be teaching you are all fast if rough ways of lighting terrain. I will not be going into complicated global illumination algorithms although I will point you to some places where you can get information on some of them because realistic terrain lighting can probably cover an entire book on its own. With that said this is the agenda for this chapter Height-based lighting Hardware lighting Applying a lightmap to terrain The ultra-cool slope-lighting algorithm I ll keep this discussion of lighting decently short because I know that you or if you don t then I know I do want to get started with the cool terrain algorithms that I ll be presenting in the next three chapters. Let s get going Height-Based Lighting Height-based lighting is simple and unrealistic but it is a type of lighting so I figured I d at least cover it briefly. We used height-based lighting in all of the demos in Chapter 2 Terrain 101 so you have used it before even if you didn t know it. Height-based lighting is just that lighting based off the height of a vertex. High vertices based on height data from the terrain patch s height data are brighter than low vertices and that s all there is to it. All that we need to do is use our GetTrueHeightAtPoint function member of the CTERRAIN class to extract the brightness of the pixel at the current x z location the value will be in the range of 0-255 from the heightmap and that is our brightness value. It s that simple Figure 4.1 reinforces the .