Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8305071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:59:50+00:00 2026-06-08T17:59:50+00:00

I’m trying to achieve the ramp effect as seen here: (source: splashdamage.com ) Blending

  • 0

I’m trying to achieve the ramp effect as seen here:

(source: splashdamage.com)

Blending the textures based on a distribution pattern is easy. Basically, just this (HLSL):

Result = lerp(SampleA, SampleB, DistributionPatternSample);

Which works, but without the ramp.
http://aaronm.nuclearglory.com/private/stackoverflow/result1.png

My first guess was that to incorporate “Ramp Factor” I could just do this:

Result = lerp(A, B, (1.0f - Ramp)*Distribution);

However, that does not work because if Ramp is also 1.0 the result would be zero, causing just ‘A’ to be used. This is what I get when Ramp is 1.0f with that method:
http://aaronm.nuclearglory.com/private/stackoverflow/result2.png

I’ve attempted to just multiply the ramp with the distribution, which is obviously incorrect. (Figured it’s worth a shot to try and discover interesting effects. No interesting effect was discovered.)

I’ve also attempted subtracting the Ramp from the Distribution, like so:

Result = lerp(A, B, saturate(Distribution - Ramp));

But the issue with that is that the ramp is meant to control sharpness of the blend. So, that doesn’t really do anything either.

I’m hoping someone can inform me what I need to do to accomplish this, mathematically. I’m trying to avoid branching because this is shader code. I can simulate branching by multiplying out results, but I’d prefer not to do this. I am also hoping someone can fill me in on why the math is formulated the way it is for the sharpness. Throwing around math without knowing how to use it can be troublesome.

For context, that top image was taken from here:
http://wiki.splashdamage.com/index.php/A_Simple_First_Megatexture

I understand how MegaTextures (the clip-map approach) and Virtual Texturing (the more advanced approach) work just fine. So I don’t need any explanation on that. I’m just trying to implement this particular blend in a shader.

For reference, this is the distribution pattern texture I’m using.
http://aaronm.nuclearglory.com/private/stackoverflow/distribution.png

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:59:51+00:00Added an answer on June 8, 2026 at 5:59 pm

    Their ramp width is essentially just a contrast change on the distribution map. A brute version of this is a simple rescaling and clamp.

    Things we want to preserve are that 0.5 maps to 0.5, and that the texture goes from 0 to 1 over a region of width w.

    This gives

    x = 0.5 + (x-0.5)/w
    

    This means the final HLSL will look something like this:

    Result = lerp(A, B, clamp( 0.5 + (Distribution-0.5)/w, 0, 1) );
    

    Now if this ends up looking jaggy at the edges you can switch to using a smoothstep. In shich case you’d get

    Result = lerp(A, B, smoothstep( 0.5 + (Distribution-0.5)/w, 0, 1) );
    

    However, one thing to keep in mind here is that this type of thresholding works best with smoothish distribution patters. I’m not sure if yours is going to be smooth enough (unless that is a small version of a mega texture in which case you’re probabbly OK.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.