Skip to content

Architecture

Valtteri Koskivuori edited this page Feb 6, 2020 · 5 revisions

A few notes on some details on how C-ray works

Shared scene data

C-ray uses shared, global arrays for polygons, vertices, texture coordinates and normals. You don't have to worry about this, as all the management is already complete and (somewhat) tested. This choice was made to simplify memory management. Thus, the mesh data structure only has to keep track of an offset, and amount of a given element belonging to it, like so:

int vertexCount;

int firstVectorIndex;

Single, global coordinate system

C-ray doesn't use local coordinates for vertex data. All objects are transformed within the global coordinate system.

Left-hand coordinate system (Y up world)

This is something that I'm looking to change, since any models you export from, say, Blender, will be mirrored on one axis.

In C-ray, X is right, Y is up, and Z is forward by default.

No instancing, simple transforms

C-ray does not support object instancing at this time. Meaning if you want multiple instances of the same mesh, you just have to load it in multiple times (thus consuming more memory) This is just to keep things simple, but I'm open to improvements on this regard.

The transform system, again, is very simple. You can rotate models, scale them and move them around using numeric coordinates and degrees. Transforms are computed and applied on the actual source coordinates, before rendering.

Primitive material system

The material system is still very limited. You can't mix shaders, and there's only a few shaders that aren't very realistic. Something to work on!

Clone this wiki locally