https://github.com/distributive-network/dcp-cycles
https://github.com/distributive-network/dcp-cycles
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/distributive-network/dcp-cycles
- Owner: Distributive-Network
- Created: 2021-04-12T17:39:23.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-04-12T17:59:11.000Z (about 4 years ago)
- Last Synced: 2025-01-10T19:47:59.818Z (4 months ago)
- Language: C++
- Size: 41.8 MB
- Stars: 0
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This is a modified version of the Cycles renderer used in Blender 3D.
The modifications are limited to stripping down dependencies to the
point where it can be compiled to javascript (using emscripten).Current status: 1.6 MB javascript output (with `elephant.xml` test
scene embedded). On my random hardware it takes about 7 seconds to
parse the test scene and render the first pass at a little 80x60
image; 8 secs for 160x120; 22secs for 640x480.Compiling
---------You'll need emscripten to compile this code. Basically, you'll be
using a specially tweaked C++ compiler that outputs javascript.
Before doing that, it is a good idea to just try compiling the code
with a regular old C++ compiler. You'll need a compiler
(e.g. `g++`) and `cmake`. Then:mkdir build && cd build && cmake .. && make
All going well, you should end up with a program called
`./bin/cycles_test` which when run spits out a bunch of
numbers (these in fact encode a picture of two elephants).scene_init.
filename faked as elephant.xml
filename faked as elephant.xml
session_init.
draw_out 80 60 4!
993 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209
...
999
Got image
session_exit.Did that work? Ok. Now back out of the "build" directory, make sure
you have `emscripten` (see https://github.com/kripken/emscripten) and try this:mkdir js_build && cd js_build && emconfigure cmake .. && make
Note the "emconfigure" in there, that switches everything over to
a different compiler. The resulting code is unrunnable, but
can be converted to javascript as follows:cp bin/cycles_test cycles_test.bc && emcc --embed-file elephant.xml --embed-file gumbo.xml cycles_test.bc -o cycles_test.js
or to create a test html page:
cp bin/cycles_test cycles_test.bc && emcc --embed-file elephant.xml --embed-file gumbo.xml cycles_test.bc -o cycles_test.html
You'll need patience :-). You'll then need to fiddle with emcc's
various flags to get a good optimized result. The .html needs to be
served by a local webserver to be viewed correctly I think.## DCP work
All of the above come from the the emcycles repo. In order to make this better for DCP, I've gone ahead and made it easier to compile (hopefully). Simplly run `./full_build.sh` after enabling and setting all your emscripten paths (`source EMSCRIPTEN/emsdk_env.sh`).
Once this completes, a JS file called `emcycles_core.js` which is the core emcycles render library.
This can be copied over into the DCP folder, where webpack can be used to webpack emcycles with some polyfills (up to your discretion).
`/dcp/dist`, you'll find the stuff to be able to publish the package up (For more info please talk to either Chris or Hamada).
Lastly in `/dcp/dist/test`, you'll find a simple test script to try to render something small according to some info from blender.