Git Product home page Git Product logo

aframe-aobake-component's People

Contributors

supereggbert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aframe-aobake-component's Issues

aobake and a-obj-model

hi,

seems not working on a-obj-model .

<a-entity aobake="exposure:1, distance:1" > <a-torus-knot material="color: #fff" position="0 1 -4" arc="180" p="2" q="3" radius="1" radius-tubular="0.2"></a-torus-knot> <a-obj-model id="model_base" scale="0.1 0.1 0.1" src="model/teapot.obj"> </a-obj-model> </a-entity>

Suggestion on applying AO to vertices

This looks like a super helpful component, thanks for putting it together!

A quick suggestion on how you're applying AO to vertices โ€“ by writing to vertex color, the result is liable to look "dirtier" than it realistically should, because the renderer is applying the same amount of light to a "darker" surface, rather than actually applying less light. You can avoid that with an interesting trick:

Create a simple gradient texture, 1x256px white-to-black. Then, write into the uv2 attribute instead of a color attribute, setting values between 1,1 and 1,255 for white to black. I've written an example here:

https://github.com/donmccurdy/glTF-Transform/blob/master/packages/ao/src/ao.ts

// A greyscale 256x1 gradient.
const TEXTURE_MIME_TYPE = 'image/png';
const TEXTURE_DATA = new Uint8Array([
    137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 1, 0, 0, 0, 0, 1, 8, 6, 0,
    0, 0, 49, 89, 112, 119, 0, 0, 0, 32, 73, 68, 65, 84, 56, 79, 99, 100, 96, 96, 248, 207, 196,
    196, 196, 0, 2, 163, 244, 104, 56, 140, 166, 131, 145, 147, 15, 24, 25, 25, 25, 0, 254, 131,
    3, 254, 243, 176, 75, 70, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130
]).buffer;
const numVertices = ao.length;
const uv2Data = new Float32Array(numVertices * 2);
for (let i = 0; i < numVertices; i++) {
    uv2Data[i * 2] = uv2Data[i * 2 + 1] = 1 - ao[i];
}
geometry.addAttribute( 'uv2', new THREE.BufferAttribute( uv2Data, ... ) );

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.