C3DEngine – A simple software renderer

using_diffuse-300x237 clip1-300x237
vertex_color-300x238 z-300x238

I write this demo just to go though some key concepts of computer graphics.
The following features are implemented in this demo:
1) transform mesh from local space to world space, then to the camera space;
2) Do projection to convert 3d triangles to 2d triangles.
3) Do clip in the clip window space, and split into two triangles if need;
4) Shader 2D triangle with diffuse texture or vertex color;
5) A float array used fo depth buffer;
6) Back surface culling in world space or camera space;
6) Texture Address mode(Clamp, Wrap & Mirror) and sampling(Point and Linear).

 

Operation

Key Z, show content of the depth buffer;
Key C, show content of the color buffer;
Key D, shader with diffuse texture;
Key V, shader with vertex color;
Key W, forward
Key S, backward
Key P, texture with nearest points sampling;
Key L, texture with linear sampling;

 

You could download the source code from here. SDL1.2 library used here to display the frame buffer content & depth buffer.

posted @   opencoder  阅读(376)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示