GithubHelp home page GithubHelp logo

voidvvv / moonengine Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ripmr/moonengine

0.0 0.0 0.0 95 MB

A toy DCC software

License: MIT License

C++ 68.41% C 28.73% Objective-C 0.29% GLSL 2.57% RenderScript 0.01%

moonengine's Introduction

MoonEngine

A toy DCC software implemented based on OpenGL and imgui

Feature List

  • PBR viewport / HDRI IBL
  • Split view / Multiple display mode
  • Interactive mesh creation
  • Hierarcial transform
  • Import and view .OBJ mesh
  • Basic viewport interaction
  • SEM Shader (ZBRush style outlook)
  • Post-Processing supported
  • Operation stack (Something like the modifiers in 3ds Max)
  • Volume rendering supported
  • Procedural texture generation
  • RABBIT RENDERER: a basic raytracing renderer
  • MOON CAKE: procedural modeling tools
  • MOON NN: node based interactive neural network training platform

Quick tutorial

viewport hotkeys

Operation Hotkey
Gizmo::Move w
Gizmo::Rotate e
Gizmo::Scale r
Camera::Pan middle mouse (hold)
Camera::Zoom mouse wheel
Camera::Rotate alt + middle mouse
Select Object left click
Delete Object delete
Select Multiple Object ctrl + left click
Centering Selected Object z
Flow Menu right click (hold)
Open Material Editor m
Open MOON NN Editor n
Search Node s
Change Shading Mode F1-F4
Switch Split/Single View space

Load OBJ model

auto boxes = MOON_ModelManager::LoadModel("Assets\\Models\\box_stack.obj");

Transform an object

boxes->transform.Translate(Vector3(0.0f, 1.0f, 0.0f), LOCAL);
boxes->transform.Rotate(Quaternion(Vector3(90.0f, 0, 0)), WORLD);
boxes->transform.Scale(Vector3(0.2f, 0.2f, 0.2f));

Create SmartMesh

Model* sphere = MOON_ModelManager::CreateSmartMesh(SmartMesh::sphere, "sphere");

Set parent

boxes->transform.SetParent(&sphere->transform);

Create Light

auto light = MOON_LightManager::CreateLight(point_light, "pointLight", Vector3(-10.0f, 10.0f, 10.0f));

Create Volume object

auto cloud = MOON_VolumeManager::CreateVolume(
	"cloud", false, Vector3::ZERO(), 
	Vector3::ONE() * -5, Vector3::ONE() * 5
);

Create a material

auto newMat = MaterialManager::CreateMaterial("MoonMtl", "new_mat");

Assign material to mesh

// a model may contain multiple sub-meshes
// *each mesh corresponds to a material
boxes->meshList[0].material = newMat;

Add post effect to stack

Graphics::postStack.push_back(new FXAA());
Graphics::postStack.push_back(new DepthOfField());

Raytracing current viewport

Renderer::StartRendering();

Abort rendering

Renderer::isAbort = true;

Create an nn via script

// graph: a container to hold all created neurons
auto graph = new NGraph("newGraph");

// n-dimensional input vector, not participating in training
// input_size: dimension of input feature
auto feature = new NVariable(Vector2(input_size, 1), graph, false, false);

// m-dimensional output vector, not participating in training
// output_size: dimension of input feature
auto label = new NVariable(Vector2(output_size, 1), graph, false, false);

// construct full connection layer
// y = wx+b
// hsize: number of neuron
auto output = new NAdd({
    new NMatMul({
        new NVariable(Vector2(hsize, input_size), graph, true),
        feature
    }, graph),
    new NVariable(Vector2(hsize, 1), graph, true)
}, graph);
                
// activation function
output = ReLU(output, graph);

// output neural node
auto predict = new NAdd({
    new NMatMul({
        new NVariable(Vector2(output_size, input_size), graph, true),
        input_vec
    }, graph),
    new NVariable(Vector2(output_size, 1), graph, true)
}, graph);

// loss function
auto loss = MSE({predict, label}, graph);

// optimizer
auto opt = Adam(graph, loss);

Do one step training

// set input feature
feature->SetVal(...);

// set label for calculate loss
label->SetVal(...);

// calculate predict vector based on input feature
opt->Forward();

// calculate gradient map
opt->Backward();

// update weight and bias
opt->Update();

// clear gradient map
opt->ClearGrad();

Video links

๐ŸŒ• MOON ENGINE v0.20๏ผšYoutube/Bilibili

๐ŸŒ• MOON ENGINE v0.03

๐ŸŒ‘ MOON NN

Screen shots


Welcome to visit my homepage: https://huanime.com.cn/.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.