Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
T

THREE

> 编程语言
Open source

c# port of Three.js

200 stars0 likes0 views
WebsiteGitHub

About

c# port of Three.js

THREE

C# port of Three.js three.js is a very powerful, simple and useful OpenGL Graphics library. I always want to express my deep appreciation to the team that created this library.(https://github.com/mrdoob/three.js). There was a time when I wanted to show how to use these 3D geometry and mathematical theories with OpenGL libraries. In that case, the examples of three.js was a very good.

However, someone who are familiar with structural languages such as C++, Java, C#, etc find it difficult to understand how three.js works. So I decided to port three.js to C++, C#. However, it seemed that it would take too much time to port the massive examples of three.js Fortunately, I found very simple and key examples in Learning Three.js written by Jos Dirksen(https://github.com/josdirksen/learning-threejs) Most of three.js core have been completed, but some code have not yet been done because I am lazy. I don't know if I can afford it, the rest will be completed as soon as time permits.

There is C++ port of Three.js (https://github.com/hjoykim/ThreeCpp)

Example code

    public override void Load(GLControl glControl)
    {
        base.Load(glControl);

        InitRenderer();

        InitCamera();

        InitCameraController();

        scene.Background = Color.Hex(0xffffff);

        var axes = new AxesHelper(20);

        scene.Add(axes);

        var planeGeometry = new PlaneGeometry(60, 20);
        var planeMaterial = new MeshBasicMaterial() { Color = Color.Hex(0xcccccc) };
        var plane = new Mesh(planeGeometry, planeMaterial);

        plane.Rotation.X = (float)(-0.5 * Math.PI);
        plane.Position.Set(15, 0, 0);

        scene.Add(plane);

        // create a cube
        var cubeGeometry = new BoxGeometry(4, 4, 4);
        var cubeMaterial = new MeshBasicMaterial(){ Color=Color.Hex(0xff0000), Wireframe= true};
        var cube = new Mesh(cubeGeometry, cubeMaterial);

        // position the cube
        cube.Position.Set(-4, 3, 0);

        // add the cube to the scene
    
	    scene.Add(cube);

  //      // create a sphere
        var sphereGeometry = new SphereGeometry(4, 20, 20);
        var sphereMaterial = new MeshBasicMaterial() { Color = Color.Hex(0x7777ff), Wireframe = true };
        var sphere = new Mesh(sphereGeometry, sphereMaterial);

  //      // position the sphere
        sphere.Position.Set(20, 4, 2);

  //      // add the sphere to the scene
        scene.Add(sphere);

    }
    public override void Render()
    {
        controls.Update();
        this.renderer.Render(scene, camera);
    }

Example Screen Capture

All examples have a trackball controller.

Rotation : Move mouse while mouse left button pressed

Move : Move mouse while mouse middle button pressed

Zoom : Mouse scroll

Chapter01 - First Scene

Chapter02 - Geometries

Chapter03 - Lensflares Light

Chapter04 -MeshPhysicalMaterial

some examples are include DataLoader like as .obj

Chapter05-Basic-3D-Geometries-Polyhedron

Chapter06 Text Geometry, Binary Operation

Cahpter07 -All the examples have been completed, but they have not been committed yet

Chapter08 - Load Obj file with MTL

Chapter09 - Trackball controls

Chapter10 env map

Chapter11 SimplePass1

Issues· 14 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C#csharpdetnetopenglopentk

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言