Jump to content

Search the Community

Showing results for tags 'Bresenham'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. I try to create mask that clip sprite(light) in this way that we will see shadows. Lets assume: 1. Draw a pixel map where black pixel means rock, white means air. 2. Draw black lightmap on it (black sprite on whole map, with MULTIPLY blending) 3. Draw an light(sprite with ADD blending) on lightmap texture by PIXI,RenderTexure these 3 steps allow us to create lightmaping on map, but lights always will go through walls. So we need to use masking. 1. use Bresenham Algorithm for rasterize Circle (with radius of our light = half of width of texture) result is array of pixels XY that create circle. 2. sort these pixels based on angle (from 0 to 360) so we have then polygon/circle data array. 3, create a mask based on these data now we have masked light but nothing is changed, now we need to raycast from center of light to each pixel on circle again with Bresenham Algorithm 1. use Bresenham Algorithm for rasterize Line from center of light/sprite to each point on circle, result is pixels on the radius/line, if one of them are Rock/black pixel - change this position/pixelXY on circle to collision position. 2. apply mask now we see occlusion to the pixels (rock/air) on map, and shadows. But.. it is too slow!! I've searched a lot of stuff to find a better way, but have nothing. Someone knows a better way for occlusion lights/sprites to pixel map(rock/air)?
×
×
  • Create New...