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

Register

Team Spartan Cookies & Milk Forums Garry's Mod Starfall v
1 2 3 4 5 … 18 Next »
Help required with overrideBlend
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linear Mode
Help required with overrideBlend
01-12-2023, 04:50 PM,
#2
Person8880 Offline
gpj.ecafllorT
*******
Posts: 2,407
Threads: 45
Joined: Sep 2013
RE: Help required with overrideBlend
Sounds like what you want is to use source colour, and destination alpha, so something like:
-- First draw your transparency mask.
drawYourTransparencyMaskHere()

-- Then set the blend mode overrides.
render.overrideBlend(
    true,
    -- Use 1 * source colour (i.e. all of the colour that's going to be drawn), and none of the existing colour, and add those together.
    render.BLEND_ONE, render.BLEND_ZERO, render.BLENDFUNC_ADD,
    -- Use none of the source alpha, and 1 * the destination alpha (i.e. take the alpha value that's already drawn), and add those together.
    render.BLEND_ZERO, render.BLEND_ONE, render.BLENDFUNC_ADD
)

-- Now draw your red colour over the top - this should end up colouring everything red with transparency.
render.setColor( 255, 0, 0 )
render.drawRect( 0, 0, 512, 512 )
This assumes you're rendering this to a render target, as setting colour/alpha values in screen space wouldn't apply the transparency part in a visible way.

Bear in mind also that rendering a transparent texture will itself blend with whatever it's rendering on top of, if you render a perfect alpha gradient on top of a black background you might get more colour than you originally expected.
Find
Reply
« Next Oldest | Next Newest »


Messages In This Thread
Help required with overrideBlend - by The17thDoctor - 29-11-2023, 09:24 PM
RE: Help required with overrideBlend - by Person8880 - 01-12-2023, 04:50 PM
RE: Help required with overrideBlend - by The17thDoctor - 01-12-2023, 07:22 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.