简体   繁体   中英

How do you extrude a texture to 3D in OpenGL?

First of all, I need to explain you all what I mean. An example of what I am talking about is the game Minecraft where the item the player is holding is rendered as a texture extruded into the third dimension.

右侧-3D挤压出的钻石剑纹理。

So how do I take a texture and extrude it?

Minecraft does not extrude any polygons. Minecraft uses simple polygons such as a rectangle and places a 16x16 texture on it. (Mods may use different resolution ones). The sword you are holding is made of polygons, it's not 2D.

To answer your questions anyways, there are several ways to "extrude" from 2D textures. Usually you use a technique called normal mapping or bump mapping. You may also use parallax mapping. Finally you can also use geometry shader to literally create new geometry.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM