Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naive AO is ready for a first look! #96

Closed
wants to merge 8 commits into from
Prev Previous commit
Next Next commit
added command line changes for AO
  • Loading branch information
likangning93 committed Jun 17, 2016
commit eae171272666b96b9f46dda6c3a4063892e20ed4
22 changes: 20 additions & 2 deletions bin/gltf-pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ if (process.argv.length < 3 || defined(argv.h) || defined(argv.help)) {
' -b --binary, write binary glTF file.\n' +
' -s --separate, writes out separate geometry/animation data files, shader files and textures instead of embedding them in the glTF file.\n' +
' -t --separateImage, write out separate textures, but embed geometry/animation data files, and shader files.\n' +
' -q, quantize the attributes of this model.\n';
' -q, quantize the attributes of this model.\n' +
' --ao_diffuse, bake ambient occlusion into the diffuse texture.\n' +
' --ao_separate, bake ambient occlusion into a separate texture and modify the shader to use it.\n' +
' --ao_scene, specify which scene to bake AO for.\n' +
' --ao_rayDepth, ray distance for raytraced ambient occlusion.\n' +
' --ao_resolution, resolution along one dimension for each AO texture.\n' +
' --ao_samples, sample count for ambient occlusion\n';
process.stdout.write(help);
return;
}
Expand All @@ -32,6 +38,12 @@ var separate = defaultValue(defaultValue(argv.s, argv.separate), false);
var separateImage = defaultValue(defaultValue(argv.t, argv.separateImage), false);
var quantize = defaultValue(defaultValue(argv.q, argv.quantize), false);

var ao_diffuse = defaultValue(argv.ao_diffuse, false);
var ao_scene = argv.ao_scene;
var ao_rayDepth = defaultValue(argv.ao_rayDepth, 1.0);
var ao_resolution = defaultValue(argv.ao_resolution, 128);
var ao_samples = defaultValue(argv.ao_samples, 16);

if (!defined(gltfPath)) {
throw new DeveloperError('Input path is undefined.');
}
Expand All @@ -49,7 +61,13 @@ var options = {
binary : binary,
embed : !separate,
embedImage : !separateImage,
quantize : quantize
quantize : quantize,
ao_diffuse : ao_diffuse,
ao_scene : ao_scene,
ao_rayDepth : ao_rayDepth,
ao_resolution : ao_resolution,
ao_samples : ao_samples,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps pack all the AO properties into an object. Also this makes it less verbose in gltfPipeline.

imageProcess : ao_diffuse
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does imageProcess still need to be true if --ao-separate is set? Maybe this type of thing will be handled later.

Copy link
Contributor Author

@likangning93 likangning93 Jun 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imageProcess is needed at both the beginning and the end of the pipeline and will probably be needed in the eventual pre-write stage, so I think it would be better to start using it now even though it's basically the same as the AO flag.

};

processFileToDisk(gltfPath, outputPath, options);