GimelStudio / GimelStudio

Non-destructive, node based 2D image editor with an API for custom nodes

Home Page:https://gimelstudio.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rewrite Noise Image node to use GLSL instead of OIIO

Correct-Syntax opened this issue · comments

In an effort to remove our hard dependence on OpenImageIO which is difficult to install properly, this issue should rewrite the Noise Image node (https://github.com/GimelStudio/GimelStudio/blob/master/src/nodes/corenodes/input/noise_image_node.py) using a GLSL shader.

Not sure why exactly but this node is not appearing in the node list when I run Gimel Studio.
How should the output look like? Just a full white noise image, or is this on top of an input image?

Not sure why exactly but this node is not appearing in the node list when I run Gimel Studio.

It's commented out here. Just un-comment that line and it will show up.

Yes, the image should just look like a black and white noise. The primary use of this node is to overlay on other nodes or use as a mask.

Yeah, I tried uncommenting that line and I still wasn't able to see the node.
I'll take another look, and in the meantime I'll start implementing it

Ah, I see. There are errors with the noise image node AttributeError: module 'gimelstudio.api' has no attribute 'PositiveIntegerProp' so of course it won't load. You'll want to migrate to IntegerProp

Yup, this solved the issue, thanks!

So there's an interesting issue with this category of nodes that we need to decide how we want to design.
Our GLSLRenderer.Render() function takes an image as an input:

def Render(self, frag_shader, props, image, image2=None):

The problem is that input nodes don't have an input image.
I imagine that we need to change the Render function's input (maybe set image to also be None by default?)

That is a good point, @yonMaor. Yes, I think setting it to None by default would be a good idea. Though, this should be done in a separate PR as it may require a change in all of the GLSL nodes.

Another way (if this is easier). Is to create a blank, Image object (a transparent image) and then pass that in. Just make sure to set the size correctly.

I agree that it should be done in a separate PR, but I'm not sure that it requires any changes to the other nodes.
All other nodes already have set the value of image, so only those that don't set its value are affected (as far as I know we don't have any such nodes yet, and the noise_image_node will be the first)

Another question we need to answer is: what is the size of the noise image?
I'm guessing that this should be user defined as a node input?

Yes, there should be two IntegerProp inputs for the image width and height. These should also be exposed as node input too. For the default, 512x512px.

There seems to be some correlation between pixels so I'll keep working on this, but I'm making some progress.

What's weird is that when I force the use of the actual resolution (in this case 512x512), instead of the resolution that I get from textureSize(input_img,0) (which is 6000x6000), I get the expected result.

This could be related to the issue that we started discussing in #147 and continued in #178

I believe that if we were to solve that, this issue could also be closed

noise_node