Skip to content

vincentdesmares/node-procgen-editor

Repository files navigation

node-procgen

Procedural generation tool

What does it do?

It allows you to setup a pipeline to procedurally generate scenes that will be available trough an API.

Scene generation main page

More here :

Project Screenshots Project 3D Assets

Table of Contents

Install

All instructions are for Ubuntu 16.04

apt-get install git curl

node & npm & yarn

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
vim ~/.bashrc
#Add at the end of the file:
alias npm-exec='PATH=$(npm bin):$PATH'
npm-exec
:wq #Then save and quit
source ~/.bashrc
nvm install 7
nvm use 7
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn

The fact that we are watching on client and server files make that we open a LOT of files. Be sure to run this command when running the project on Ubuntu or you may have this error :

"Error: watch /home/cold/projects/editor/node_modules/.cache/babel-loader/xxx.json.gz ENOSPC"

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Get the project

git clone git@github.com:vincentdesmares/node-procgen-editor.git
cd node-procgen-editor
yarn
yarn start

Python deps

sudo apt-get install -y python-pip python-dev python-pycurl 
/usr/bin/python -m pip install pylint

Install last blender :

ppa:thomas-schiex/blender
sudo apt-get install blender

GIS deps

brew install postgresql postgis
pg_ctl -D /usr/local/var/postgres/data -l /usr/local/var/postgres/server.log start

Starting

yarn start-all

A page should open in your browser at localhost:3000, then you can open:

http://localhost:8080/graphiql

To be able to discover the project schema.

Commands

Generating a new test

blender -b -P test2.py

Working with postgis

Finding which GDAL drivers are installed (in case of rt_raster_to_gdal: Could not load the output GDAL driver)

SELECT short_name FROM ST_GDALDrivers();

ALTER SYSTEM SET postgis.gdal_enabled_drivers TO 'ENABLE_ALL';
SELECT pg_reload_conf();

SELECT oid, lowrite(lo_open(oid, 131072), GTiff) As num_bytes
 FROM
 ( VALUES (lo_create(0),
   ST_AsTIFF( (SELECT rast FROM terrain WHERE rid=1) )
  ) ) As v(oid,GTiff);

SELECT lo_export(18186, '/Users/vincent/projects/node-procgen-editor/public/test.tif');
gdal_translate -scale 0 2470 0 65535 -ot UInt16 -outsize 100 100 -of ENVI public/assets/test.tif public/assets/test.bin

color-relief public/assets/test.tif data/color-relief.txt public/assets/test-relief.tif

gdaldem hillshade -combined public/assets/test.tif public/assets/test-hillshade.tif

gdaldem slope public/assets/test.tif public/assets/test-slope.tif
gdaldem color-relief public/assets/test-slope.tif data/color-slope.txt public/assets/test-slopeshade.tif

Tif -> PNG

gdal_translate -of PNG -scale public/assets/test.tif public/assets/test-output.png

Generate mask

gdaldem color-relief public/test-bicolor.tif data/color-relief-0-1.txt public/assets/test-relief-bicolor.tif
gdal_translate -of PNG -scale public/assets/test-relief-bicolor.tif public/assets/test-output-bicolor.png

Preview all the values in a raster :

SELECT (pvc).*
FROM (SELECT ST_ValueCount(rast) As pvc
    FROM terrain WHERE rid=1) As foo
    ORDER BY (pvc).value;

TODO list

  • Make a basic execution pipeline for scenes
  • Make batches work (with status "stashed")
  • Add terrain in database
  • Add zones in database
  • Visualize zones in 3d
  • Add placement in database
  • Visualize placement in 3d
  • Add entities in database
  • Visualize entities in 3d
  • Delete old jobs when re-assigning them to a scene scenario.
  • plop

Project References

Create React App Blender 2.78c Documentation Visualize your assets online: A360.AutoDesk Postgis Raster Doc Texturing a raster

About

An inteface for all the node-procgen tools

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published