Skip to content

WIP cube GL demo - #1

Draft
jcorbin wants to merge 20 commits into
mainfrom
cube_gl
Draft

WIP cube GL demo#1
jcorbin wants to merge 20 commits into
mainfrom
cube_gl

Conversation

@jcorbin

@jcorbin jcorbin commented Jun 28, 2022

Copy link
Copy Markdown
Contributor

Current attempt at minimally demonstrating an alternate rendering approach using webgl(2):

  • uses a 2d canvas to create a texture sheet/atlas
  • then uses an ortho-projected GL context to draw points textured by that atlas

Here's some other reference tutorials / code:

Next steps from minor to stellar:

  • fix alpha blending arftifacts
  • add per-tile rotation or at least mirroring
  • switch to a 2d array texture
  • switch to an offscreen canvas
  • animation at some level
  • implement something for drawing (back)ground fill, this can start out as a boring solid color of course, but we now have the full power of fragment shading to do procedural texturing for things like grass, water, etc
    • Marching Sqaures tileset demo
    • other factor out an autotiling system from the code inlined in the html demo
    • experiment with procedural patterning or shading for background tile style beyond solid colors
  • experiment with twisting the perspective matrix and introduce a model/view transform matrix
  • see how well 2.5d / pseudo-3d things work on this textured point approach
  • scale up and out to planetary cube/dia scale ; whether we're able to just keep drawing transformed points in 3-space as in prior point, or whether we instead add an intermediate step where we render points onto faces of one or more cubes

@jcorbin
jcorbin requested a review from kriskowal June 28, 2022 21:00
@vercel

vercel Bot commented Jun 28, 2022

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cube ❌ Failed (Inspect) Sep 29, 2023 10:46pm
forest ❌ Failed (Inspect) Sep 29, 2023 10:46pm
jspit ❌ Failed (Inspect) Sep 29, 2023 10:46pm

@jcorbin

jcorbin commented Jun 29, 2022

Copy link
Copy Markdown
Contributor Author

Right, so the alpha deal all comes down to handling pre-multiplied alpha (or not); which is probably why the default is "Nope, you need to set how that works, and don't get any default blending". I.E: "Not all rgba is the same"

For us part of the context is that 2d canvas contexts all work in pre-multiplied alpha, so when we scrape a texture in from a canvas, we have to deal with that, and then may have a texture that contains pre-multiplied alpha.

References:

- using glsl es 3.0 and a basic sprite billbaord deal
- using OffscreenCanvas and 2d array texture
- support spin
- design document
- background tiles
- tile sheet
- layered world
- curved tileset demo
- element oriented drawing with implicit locaiton
- faceted groups of layers
Make it more self contained, and directly gl integrated, rather than a
bare data structure for layer/drawing code.
- contains layered drawing, decoupled form architecture like facets
- abstracts gl program interface
- pushes more particulars down into layer.draw()
Optionize and change world dimensions for example
- generation corner sourcing was always wrong
- needs to be +1 cell to cover the half cell overlap all around
- therefore needs to be clipped to the nominal layer bounds
- more routines in tilegen module
- demo edge clipping vs extension
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant