Announcement

Collapse
No announcement yet.

Bright green pixels on renders

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bright green pixels on renders

    Hello,

    I've been making some custom shaders. When rendering using them, I am finding that intermittently and inconsistently I get random green pixels in the images. They tend to happen towards the boundaries of objects (although not always). Here's some examples:

    Click image for larger version

Name:	render_green_spots.png
Views:	1
Size:	65.4 KB
ID:	879857 Click image for larger version

Name:	render_green_spots_3.png
Views:	1
Size:	54.8 KB
ID:	879858

    Has anyone seen this before and know what causes it? I'm wondering if there's something in the way that I've written my shader material that causes it.

    Thanks very much - any help much appreciated!

    Lindsey

  • #2
    This usually happens when you have NaN or infinite values is your calculations somewhere; these result from divisions by zero, square roots of negative numbers and such like.

    You could track these down by adding checks whether the results are finite numbers at the end of your calculations using f.e. the _finite() (on Windows) or finite() (on Linux) function and checking under what conditions it returns false. Of course, you wouldn't want these in a production version, so it might be good to #ifdef them.

    Another way to track this down could be to temporarily enable floating-point exceptions and debug when they happen, but this is done in a very OS-specific way.

    Best regards,
    Vlado
    I only act like I know everything, Rogers.

    Comment


    • #3
      Great, thank you Vlado. I'll look for NaNs and infinite values then and see if I can track down the problem.

      Thanks for the clue, at least I know where to start looking

      Lindsey

      Comment


      • #4
        No problem; this is a common issue when coding BRDFs and shaders in general and it might take a bit of time to track down all the cases that might lead to it.

        Best regards,
        Vlado
        I only act like I know everything, Rogers.

        Comment

        Working...
        X