Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

12
  • $\begingroup$ Thank you so much for the explanation! After writing this post I did come to the conclusion that I was supposed to render a box "inside out" but the "inside out" part I wasn't sure what was meant, so your advice to flip the normals clarified that. I am also additively blending. Now at this point I have the box rendering at world position (0,0,0) with the normals flipped. I am using the camera view and position in world space for now just to be safe and since the box is at (0, 0, 0) I should be fine. (continued) $\endgroup$ Commented Oct 13, 2021 at 20:40
  • $\begingroup$ Now the last question I have is, what value am I supposed to pass to pobject? From the book explanation, it sounds like I need to pass the current pixel position of the pixel that the box shader is currently rendering. But reading the comment above the description of the function it says: "This shader renders a halo effect of radius R at the object-space position pobject." so it makes it sound like in my case, I should pass (0,0,0). I tried both and neither give the result of rendering the basic shape of the halo. $\endgroup$ Commented Oct 13, 2021 at 20:40
  • $\begingroup$ Also I should mention, if I pass (0,0,0) to pobject, the result I get seem to be correct in the case where the camera is inside the radius R. If the camera steps outside of this radius, nothing is rendered. $\endgroup$ Commented Oct 13, 2021 at 20:52
  • $\begingroup$ pobject is the position values of the object which is the cube that is being rendered. So compute gl_Position using the mvp matrix and pass the the pobject values down to the fragment shader. $\endgroup$ Commented Oct 13, 2021 at 21:30
  • $\begingroup$ I used the pixel world position and it seems to (almost) work! I updated my post with the details. $\endgroup$ Commented Oct 14, 2021 at 5:11