Jump to content

View more

Image of the Day

Adding some finishing touches...
Follow us for more
#screenshotsaturday #indiedev... by #MakeGoodGames https://t.co/Otbwywbm3a
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Sign up now

Glsl geometry shader difficulties

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 Misantes   GDNet+   


Posted 12 August 2014 - 09:23 PM


I'm just an idiot who was rendering things in the wrong order. Everything is working great, minus my brain, apparently. Had I figured this out 2 minutes sooner, I could have saved the mods the trouble of deleting this post >.<


Mods, feel free to delete this if needed, I'll leave everything up as a warning to always check your render order, but otherwise the rest of the post is moot.




So, this week I've started delving into glsl shaders. I'm using the book "GLSL Essentials" by packt publishing. I've successfully gotten my geometry shader up and running as a particle generator. The tutorial example works great. however, it generates the transparent portions of the image by:

if(color.a < 0.3)

This is great for the tutorial image. But, for anything semi-complex like a smoke or fire, or really anything other than basic geometric shapes, it seems like a blunt tool that results in an ugly result, cutting out too much/too little and leaving a jagged image.


Previously (on the advice of some kind soul on these forums), I would simply set the alpha thusly:

vec4 MaterialDiffuseColor = texture( textureSampler, UV );
color.a = MaterialDiffuseColor.a;

However, doing things the same way in the fragment shader no longer works when paired with a geometry shader, and I'm a little lost as to why.


My initial impressions are that the way I'm passing in the UV coordinates is problematic somehow. However, again, as the image appears in-game, minus the transparent bits, I feel like I could rule this out.


my blendfunc for these is set:


Is there some fundamental piece of opengl/glsl I'm missing as to why the same method wouldn't work when the fragment shader is paired with a geometry shader? I've made a normal particle generator that renders the images perfectly, though it's entirely CPU side, and therefore gets a little resource heavy rather quickly if overused. So, I'd like to figure out how to do this GPU side. And, I believe I grasp the concept of the geometry shader, but I'm borking up some of the details.


posting the vertex, geometry and fragment shader here in this post seems overkill. You can find them:





Anyhow, thanks in advance for any help offered. I truly appreciate it! biggrin.png

Edited by Misantes, 12 August 2014 - 09:30 PM.

Beginner here <- please take any opinions with grain of salt Posted Image

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.