My grid is getting created on the wonk

I have tried to debug this but I honestly cant see anything wrong with it, I was wondering if anybody can help.

Basically what it does is process a 64x64 pixel texture and deletes sections of a grid based on the luminance of each pixel, I am in the process of revamping my code and all was going well until I reached this bit, I cant see why it would be making my grids come out with a diagonal slant as if each iteration was offsetting by one unit to the right.

heres what it looked like right in the obsolete code

alt text

and here is it in the new code

alt text

using UnityEngine; using System.Collections; using System.Collections.Generic;

public class NoiseProcessor : MonoBehaviour {

 public Texture2D noiseTex;
 public static Color[] pxList = new Color [4096];    
 // INIT
 void Start ()
     pxList = noiseTex.GetPixels();
 void TextureTranslator(){    
     int counter = 0;
     for ( int row = 0; row < 63; row++ ){
         for (int col = 0; col < 63; col++ ){
             //Debug.Log(row + "_" + col);
             Debug.Log(counter + " " + pxList[counter].grayscale);
 // is not black fuction ~ returns bool 
 bool isNotBlack(int i){
     if(pxList[i].grayscale <= 0.3){
         return false;
     } else {
         return true;



more ▼

asked Aug 10, 2011 at 12:18 AM

avatar image

396 33 35 51

thanks for fixing the formatting

Aug 10, 2011 at 01:28 AM sacredgeometry
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

FIXED: The for loop conditional operator should have been

more ▼

answered Aug 10, 2011 at 01:02 PM

avatar image

396 33 35 51

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Aug 10, 2011 at 12:18 AM

Seen: 862 times

Last Updated: Aug 11, 2011 at 12:10 AM