I'm currently playing about with a "seamless space nebula generator", for want of a better buzz word.
I'm almost there, but the final hurdle appears to be my alphablending. I have three "clouds" (tinted to a colored 'gas' which are applied to the base image (black background with random 'stars') one after the other. Or so the theory goes. ;)
My problem is the difference in results when doing it in code and 'mocking' it up in PSP.
PSP (the desired result)

Generated:

After a chat with Rob Cummings, it looks like I'm using a kind of 'additive alpha blending' technique. The result is that the more I 'alpha-layer', the more 'muddy' the image gets. I remember a topic about blood textures in 3D saying that the alpha-blending should be; "multiplicative"? So, I'm wondering how to achieve that effect using rgb comparisons.
The current code goes like this:
Where redlevel# is the current pixel color, redlevel1# is the color that I want to alpha-blend and alphalevel1# is the transparency level (0.0 to 1.0) Similarly for green and blue.
After discussing it further with Rob, we've speculated it may be something to do with redlevel# (current pixel color)'s value being over or under 127, as was the case in my Image_Processing_Brightness function:
But I'm drawing a blank to be honest. So, I'm here for a bit of a brainstorming session, hopefully resulting in a modified alpha-blending equation that produces the PSP-style result.
Let me know if you need any more Gen, but for now, over to you guys. :D
I'm almost there, but the final hurdle appears to be my alphablending. I have three "clouds" (tinted to a colored 'gas' which are applied to the base image (black background with random 'stars') one after the other. Or so the theory goes. ;)
My problem is the difference in results when doing it in code and 'mocking' it up in PSP.
PSP (the desired result)

Generated:

After a chat with Rob Cummings, it looks like I'm using a kind of 'additive alpha blending' technique. The result is that the more I 'alpha-layer', the more 'muddy' the image gets. I remember a topic about blood textures in 3D saying that the alpha-blending should be; "multiplicative"? So, I'm wondering how to achieve that effect using rgb comparisons.
The current code goes like this:
redlevel# = redlevel# - ((redlevel# - redlevel1#)*alphalevel1#) greenlevel# = greenlevel# - ((greenlevel# - greenlevel1#)*alphalevel1#) bluelevel# = bluelevel# - ((bluelevel# - bluelevel1#)*alphalevel1#)
Where redlevel# is the current pixel color, redlevel1# is the color that I want to alpha-blend and alphalevel1# is the transparency level (0.0 to 1.0) Similarly for green and blue.
After discussing it further with Rob, we've speculated it may be something to do with redlevel# (current pixel color)'s value being over or under 127, as was the case in my Image_Processing_Brightness function:
If redlevel < 128 Then redlevel = Int(redlevel - (127-redlevel)*contrast) + brightness Else redlevel = Int(redlevel + (redlevel-127)*contrast) + brightness End If
But I'm drawing a blank to be honest. So, I'm here for a bit of a brainstorming session, hopefully resulting in a modified alpha-blending equation that produces the PSP-style result.
Let me know if you need any more Gen, but for now, over to you guys. :D