shithub: 3dee

ref: a3add1cdcbd30704a34d2876f556d0bff8694402
dir: /readme/

View raw version
3D Environments in Plan 9

You will need:

	• libgeometry (ships with 9front)
	• libgraphics
and
	• libobj

`mk pulldeps` should take care of everything.

TOOLS

	- vis: a scene visualizer
	- med: a model editor (WIP)
	- solar: a solar system planetarium (WIP)

USAGE

	vis [-s] [-t picfile] [-g wxh[xs]] model...

	The s option will switch the skybox on (performance will drop
	considerably).
	The t flag takes as input an image(6) file used to texture the first model.
	The g flag takes as input the dimensions of the camera viewport.  If it's
	smaller than screen the image will be upscaled to fit it as much as
	possible, otherwise it will default to the screen dimensions.
	The models supported by the program are OBJ files with material data (MTL
	files).  You can find examples in the mdl/ folder.

	NOTE:	Now two visibility determination technologies are available: the
		Z-buffer and the A-buffer. To get the best results out of them the
		following configurations are recommended:

		- z-buffer: blend OFF | z-buf (depth testing) ON  | a-buf OFF
		- a-buffer: blend ON  | z-buf (depth testing) OFF | a-buf ON

	- move camera with ↑↓ ((for|back)ward), ←→ (horizontally), PgUp and PgDn (vertically).
	- rotate camera with AD (yaw), WS (pitch), QE (roll).
	- change cameras with F[1-4]. cameras 1 and 3 are orthographic, 2 and 4 perspective.
	- to zoom in and out use Z and X respectively, also mouse ScrUp and ScrDn.
	- to show the HUD with stats and context information press H.
	- pressing RMB shows a shader selection menu.
	- pressing MMB shows a menu with a variety of controls.
	- holding down the LMB while moving the cursor will change the scene orientation.
	- to quit press Del.

	Vis also has a hidden option, ι, which enables inception mode.
	Use it wisely, or you might never come back.


	med

	- move camera with ↑↓ ((for|back)ward), ←→ (horizontally), PgUp and PgDn (vertically).
	- rotate camera with AD (yaw), WS (pitch), QE (roll).
	- to zoom in and out use Z and X respectively, also mouse ScrUp and ScrDn.
	- to show the HUD with stats and context information press H.
	- pressing RMB shows a menu to select shaders and add primitives/solids.
	- pressing MMB shows a menu to control the texture samplers.
	- holding down the LMB while moving the cursor will change the scene orientation.
	- to quit press Del or select "quit" from the MMB menu.


	solar [-ms]

	The m option enables museum mode.  In this mode the planets and sun will
	spawn along the x-axis, as close to each other as their sizes allow, so
	you can move through them more easily.
	The s option will switch the skybox on (performance will drop
	considerably).

	- move camera with ↑↓ ((for|back)ward), ←→ (horizontally), PgUp and PgDn (vertically).
	- rotate camera with AD (yaw), WS (pitch), QE (roll).
	- to zoom in and out use Z and X respectively, also mouse ScrUp and ScrDn.
	- to show the HUD with stats and context information press H.
	- pressing MMB shows a menu to control the movement speed.
	- point at a body and click LMB to select it.
	- to quit press Del or select "quit" from the MMB menu.

	In addition to the key controls, there are three buttons in the command
	box, at the bottom of the screen:

	- look at: pressing LMB will show a menu with a list of
		planets to choose from.  Select one and release, and the camera
		will focus on it.
	- go to: pressing LMB will show a menu with a list of planets
		to choose from.  Select one and release, and the camera will go to
		a close enough point outside of it.
	- date: when not in museum mode, the location for each of the
		planets will be pulled from NASA's Horizons API ephemerides for
		the current date.  Click on it and enter a new date—with the same
		format—to grab the ephemerides from that date and update planet
		positions.

CUBEMAPS

	The skyboxes for vis and solar are stored in the cubemap/ folder.  To use
	them you first have to convert them from JPEG to image(6), using the
	helper script (conv) available in each of them.

	% for(d in cubemap/*)@{ cd $d && conv }