Team Spartan Cookies & Milk Forums
  • Issue Tracker
  • Donations
  • Search
  • Member List
  • Help

Register

Team Spartan Cookies & Milk Forums Feedback Suggestions and improvements v
« Previous 1 … 11 12 13 14 15 … 36 Next »
Emitter's drawing priority
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linear Mode
Emitter's drawing priority
05-04-2020, 02:09 PM,
#2
Person8880 Offline
gpj.ecafllorT
*******
Posts: 2,407
Threads: 45
Joined: Sep 2013
RE: Emitter's drawing priority
This happens because 3D2D rendering disables writing to the depth buffer (though still tests against it).

I've added a new function, render.overrideDepthEnable() which will allow you to force depth writing to be enabled. Use this before starting a 3D2D camera with opaque drawing operations to have it properly respect depth.

For example (taken from the docs):
-- Force depth writing to be enabled (must be done outside the 3D2D block). 
render.overrideDepthEnable( true, true )

-- First render a red rectangle.
render.start3D2D( Pos, Ang, 0.1 )
render.setColor( 255, 0, 0 )
render.drawRect( 0, 0, 256, 256 )
render.end3D2D()

-- Then render a yellow rectange behind it, note how this rectangle is occluded.
-- If you comment out the overrideDepthEnable above, this will draw over the top of the red rectangle.
render.start3D2D( Pos - Dir * 5, Ang, 0.1 )
render.setColor( 255, 255, 0 )
render.drawRect( 0, 0, 256, 256 )
render.end3D2D()

-- Stop overriding depth writing.
render.overrideDepthEnable( false )

Note that for translucent elements, this won't help. Translucent elements have to be drawn in the right order as it doesn't make sense for them to write to the depth buffer (and if you try it you'll get very strange results).
Find
Reply
« Next Oldest | Next Newest »


Messages In This Thread
Emitter's drawing priority - by The17thDoctor - 04-04-2020, 08:15 PM
RE: Emitter's drawing priority - by Person8880 - 05-04-2020, 02:09 PM
RE: Emitter's drawing priority - by The17thDoctor - 05-04-2020, 03:13 PM
RE: Emitter's drawing priority - by mariofludd - 05-04-2020, 03:56 PM
RE: Emitter's drawing priority - by Person8880 - 05-04-2020, 03:58 PM
RE: Emitter's drawing priority - by The17thDoctor - 05-04-2020, 04:01 PM

  • View a Printable Version
Forum Jump:


Users browsing this thread: 1 Guest(s)
Contact UsTeam Spartan Cookies & MilkReturn to TopLite (Archive) ModeMark all forums readRSS Syndication

Powered By MyBB, © 2002-2026 MyBB Group.