Git Product home page Git Product logo

pex-renderer's Issues

Z-Prepass

Render z-buffer first to avoid duplicated pixel shader work.

This would also allow to compute SSAO in advance and use when shading.

Handle window resize

With the latest code (pex-renderer and pex-context) the following is now possible:

window.addEventListener('resize', () => {
  const W = window.innerWidth
  const H = window.innerHeight
  ctx.gl.canvas.width = W // ctx will pickup that change and update default viewport
  ctx.gl.canvas.height = H
  cameraEnt.getComponent('Camera').set({
    viewport: [0, 0, W, H]
  })
})

You need to update only Camera as all width/height code has been removed from the Renderer itself.

This ctx.gl.canvas.width is a bit ugly so alternatively we could do

window.addEventListener('resize', () => {
  ctx.resize(window.innerWidth, window.innerHeight)
  cameraEnt.getComponent('Camera').set({
    viewport: [0, 0, window.innerWidth, window.innerHeight]
  })
})

There is a question about "retina resolution" that requires the following code.

window.addEventListener('resize2', () => {
  const W = window.innerWidth
  const H = window.innerHeight
  ctx.gl.canvas.width = W * 2
  ctx.gl.canvas.height = H * 2
  ctx.gl.canvas.style.width = W + 'px'
  ctx.gl.canvas.style.height = H + 'px'

  cameraEnt.getComponent('Camera').set({
    viewport: [0, 0, W * 2, H * 2]
  })
})

Changing it to the ctx.resize version is ambiguous...

ctx.resize(W * 2, H * 2) // who sets canvas.style.width = W ?
ctx.resize(W, H, 2) //?
ctx.resize(W, H, { pixelRatio: 2 }) //?
ctx.resize(H, H, { scale: 2 }) //?

// and additionally
var ctx = createContext({ width: W, height: H, pixelRatio: 2 })
//ctx.defaultState.viewport[2] is now W * 2...

Octahedral maps for PREM

There are problems with using CubeMaps for Prefiltered Mipmaped Radiance Environment Maps

  • textureCubeLod is still not supported in Firefox on OSX
  • seamless cubemap filtering is not available in WebGL 1
  • most importantly we can't render to HDR CubeMap mipmap levels > 0 on iOS

Use Octahedral maps as described in WebGL Insights: HDR Rendering could solve all that issues.

screen shot 2016-05-04 at 10 45 43

DOF

Could be done using depth aware bilateral box blur like SSAO

Transparent postprocessing

Currently with post-processing on the resulting scene has black background.

screen shot 2018-07-19 at 23 13 20

So no point doing postprocessing. How can i pack HDR in RGBA and transparency? Probably not possible and have to stick to forward rendering on top of the map.

Broken shadows on Radeon Pro 460 and Intel HD Graphics 630

dcylobuwsaefqb8 jpg-large

Works on my old GeForce and Intel GPU

The problem seems to be with addressing array of depth maps for directional lights

#define NUM_LIGHTS 1

// gl.DEPTH_COMPONENT, NEAREST, NEAREST
uniform sampler2D uDirectionalLightShadowMap;
uniform sampler2D uDirectionalLightShadowMaps[NUM_LIGHTS];

// not working
// get 0 or 1 on Radeon Pro 460
// get 0 on Intel HD Graphics 630
for (int i = 0; i < NUM_LIGHTS; i++) {
 float depth = texture2D(uDirectionalLightShadowMaps[i], uv).r;
}

// working, I get depth gradient
float depth = texture2D(uDirectionalLightShadowMap, lightUV).r;
float depth = texture2D(uDirectionalLightShadowMaps[0], lightUV).r;

Although separated use case (bunny with shadows in raw pex-context) can't recreate the issue.

DOF bug

Macbook Pro (Retina, 13-inch, Mid 2014)
Intel Iris 1536 MB

Remove unused dependencies

Running

depcheck --ignore-dirs=examples,experiments

returns quite a lot of old unused stuff still being installed

Unused dependencies
* async
* gl-constants
* glsl-atmosphere
* glsl-fxaa
* glsl-gamma
* glsl-inverse
* glsl-perturb-normal
* glsl-random
* glsl-transpose
* is-mobile
* pex-cam
* pex-context
* pex-draw
* pex-gl
* pex-gui
* pex-io
* primitive-cube
* primitive-sphere
* scene-tree
Missing dependencies
* plask
* glslify-sync

Fallback for max num supported textures

Adding more lights with shadows maps can bump number of textures higher than max supported (e.g. 16). Additional lights should have shadows disabled or a warning issued.

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.