- Modes: - solid - depth - lines - normal
- Parallel & Point Light Sources
- Support for Texture & Normal Map
- Support for Smooth Shading
- Support for Shadows
- Camera Control
- Support for screen-shot
- Support for high-resolution, offline, statistic rendering
- Read .obj (and .mtl) file(s)
--- Enter rendering procedure --- - initiate depth-buffer
- for over all objects
- for over all faces (triangles) in each object
- substract 3 vertices by the camera coordinate
- rotate the 3 vertices
- cull the face if needed
- clip the triangle against the near z-plane and get 0/1/2 triangles
- retrieve the svn (if smooth shading) or u&v (if textured) or nu&nv (if normal_mapped)
--- Start to Rasterize --- - len(inside) = 3
- sort three vertices
- cull some vertices
- if solid
- if smooth_shading
- rasterize (get x3d, y3d, z3d, snx, sny, snz)
- calculate luminace
- rasterize (get x3d, y3d, z3d, snx, sny, snz)
- if flat_shading
- rasterize (get x3d, y3d, z3d, nx, ny, nz)
- calculate luminace
- rasterize (get x3d, y3d, z3d, nx, ny, nz)
- if smooth_shading
- if textured & normal_mapped
=> flat_shading- rasterize (get x3d, y3d, z3d, u, v, color, normal)
- calculate luminance
- rasterize (get x3d, y3d, z3d, u, v, color, normal)
- if textured
- if smooth_shading
- rasterize (get x3d, y3d, z3d, u, v, color, snx, sny, snz)
- calculate luminace
- rasterize (get x3d, y3d, z3d, u, v, color, snx, sny, snz)
- if flat_shading
- rasterize (get x3d, y3d, z3d, u, v, color, nx, ny, nz)
- calculate luminace
- rasterize (get x3d, y3d, z3d, u, v, color, nx, ny, nz)
- if smooth_shading
- if normal_mapped
=> flat_shading- rasterize (get x3d, y3d, z3d, u, v, nx, ny, nz)
- calculate luminace
- rasterize (get x3d, y3d, z3d, u, v, nx, ny, nz)
- for over all faces (triangles) in each object
- objects [Object, Object, ...]
- default_loading_dir "E:\Programming\Python\Python-3D-renderer\models\"
- default_uv_map_size (INTp, R, G, B)
- name str
- center [x, y, z]
- faces_count INTp
- shade_smooth bool
- mtl Material/None
- hastexture bool
- hasnormal_map bool
- culling bool
- no_lighting bool
- v [[x, y, z], [...], ...]
- vt [(u, v), (...), ...]
- vn [[x, y, z], [...], ...]
- faces [[(A_index:INTw, B_index:INTw, C_index:INTw), (Auv_index:INTw, Buv_index:INTw, Cuv_index:INTw)/None, normal_index:INTw/None, (Asn_index:INTw, Bsn_index:INTw, Csn_index:INTw)/None], [...], ...]
- x_r float
- y_r float
- z_r float
- rotation ((float, float, float), (..., ..., ...), (...))
- hidden bool
- shadow bool
- svn [[x, y, z], [...], ...]
- materials {name:Png, ...:..., ...}
- name str
- normal_map None/Png
- texture None/Png
- texture_path None/str
- normal_map_path None/str
- light_sources [Light, Light, ...]
- x float
- y float
- z float
- dirx float
- diry float
- dirz float
- r INT[0, 255]
- g INT[0, 255]
- b INT[0, 255]
- x_in_cam float
- y_in_cam float
- z_in_cam float
- dirx_in_cam float
- diry_in_cam float
- dirz_in_cam float
- type 0/1/2
- hidden bool
- shadow bool
- shadow_map0 [[z, z, ...], [...], ...]/None
- shadow_map1 [[z, z, ...], [...], ...]/None
- shadow_map2 [[z, z, ...], [...], ...]/None
- shadow_map3 [[z, z, ...], [...], ...]/None
- shadow_map4 [[z, z, ...], [...], ...]/None
- shadow_map5 [[z, z, ...], [...], ...]/None
- shadow_map6 [[z, z, ...], [...], ...]/None
- rotation0 ((float, float, float), (..., ..., ...), (...))
- rotation1 ((float, float, float), (..., ..., ...), (...))
- rotation2 ((float, float, float), (..., ..., ...), (...))
- rotation3 ((float, float, float), (..., ..., ...), (...))
- rotation4 ((float, float, float), (..., ..., ...), (...))
- rotation5 ((float, float, float), (..., ..., ...), (...))
- rotation6 ((float, float, float), (..., ..., ...), (...))
- z_near float
- z_far float
- x float
- y float
- z float
- yaw float
- pitch float
- roll float
- z_near float
- z_far float
- fov NUM(0, 180)
- width INTp
- height INTp
- fxaa bool
- obj_buffer bool
- rendering_plane_z float
- rotation [[Xx, Xy, Xz], [Yx, Yy, Yz], [Zx, Zy, Zz]]
- light Light/None
- frame [[(R:INT[0, 255], G:INT[0, 255], B:[0, 255]), (...), ...], [...], ...]
- depth_buffer [[(z, u, v, obj), (...), ...], [...], ...]
if bake:
for light in lights:
if type == 0:
light_render()
else:
light_render