I’m working a potato Global Illumination (radiosity) method.
I made a first version of the code as prototype to shop around unity’s function, to know how to do it in unity, carefully reading manual, scripting reference, research paper, open source code, ie doing extensive research to make sure I do it right. It worked as expected, i code it up to generating occlusion data.
But the code was being too spaghetti with failed implementation and overlapping responsibility, so now I figure out what works and what didn’t, I decided to refactor it to future proof it, and implement the last bit about the GI resolution. I would expect for that part to be one which would have broken, so needed iterations to make perfect.
Except not at all, I’m getting stuck way before any of that matter, and in the most curious way.
When I run the code i get a blue screen, which should be the texture generation camera, but I don’t know why it doesn’t render the main camera for the scene like it did with the previous code.
Worse the prefab “blew up” by losing its material afterwise, and I don’t know why, there is error code that is fired.
I double checks for nulls, I even created a debug primitive to checked for material assignement as this part of the code seems to create the blowing up:
Material dmat =new Material(shader.debugshader);
root.GetComponent<Renderer>().material = dmat;
Which doesn’t seems to do anything illegal. I thought it might be scope problem, but i’m unable to confirm this.
I have been double checking for days already I still don’t get it, and has no clue where to proceed.
I shared code here:
And the main thread where I reported my progress in the GI is there: