Discuss Scratch

MartinBraendli2
Scratcher
100+ posts

Non-photorealistic rendering projects

A reply to this comment from @layzej:

layzej wrote:

The one that is closest to the original isn't necessarily the one that looks best in B+W. #5 has better contrast between sea and sky and between foreground and background.

Yes, that't true for this picture, but its pure luck. For every colour conversion method, there are images that give good and bad contrast. I set this image up deliberately for #5 (Photoshop) to perform weak in terms of contrast:

Original:


Photoshop:


Rhodopsin-Gamma:


I don't think the Photoshop method gives better or worse contrast results in general, it really depends on the image. However, the Photoshop method has some problems that R-G doesn't have (notice the dark artefacts around the text, or the way too dark middle of the gradients).
In R-G the middle of the gradients is also darker than the 2 ends, which it shouldn't be. However, this is due to the fact that the original was also done in Photoshop, which made the gradient without respecting gamma-correctness.

EDIT: Spelling

Last edited by MartinBraendli2 (June 19, 2016 15:31:32)


Layzej
Scratcher
100+ posts

Non-photorealistic rendering projects

MartinBraendli2 wrote:

A reply to this comment from @layzej:

layzej wrote:

The one that is closest to the original isn't necessarily the one that looks best in B+W. #5 has better contrast between sea and sky and between foreground and background.

Yes, that't true for this picture, but its pure luck. For every colour conversion method, there are images that give good and bad contrast. //

Maybe the perfect method would analyse the picture and assign an optimal factor to each colour.
gtoal
Scratcher
1000+ posts

Non-photorealistic rendering projects

Needs tweaking, but I just realised that one of the tricks people were using to draw pseudo-spheres could be modified to produce more realistic-looking sphere shading… https://scratch.mit.edu/projects/114516089/ I'm thinking that (possibly in conjunction with an ellipse drawer?) this technique could be pretty good for drawing planets, billiard balls, molecules - a whole bunch of things…
gtoal
Scratcher
1000+ posts

Non-photorealistic rendering projects

gtoal wrote:

Needs tweaking, but I just realised that one of the tricks people were using to draw pseudo-spheres could be modified to produce more realistic-looking sphere shading… https://scratch.mit.edu/projects/114516089/ I'm thinking that (possibly in conjunction with an ellipse drawer?) this technique could be pretty good for drawing planets, billiard balls, molecules - a whole bunch of things…

I need to ask for some help from a pen expert - I've posted the problem to ‘help with scripts’ at https://scratch.mit.edu/discuss/topic/205683/ - could you answer there if you can help please?

What i'm working on is tricks for taking raster images and using them in 3D scenes by modifying them with pen drawings that conform to the 3D model that might have produced the raster image. So far I've got two different situations that this seems like a good fit for… the first is the dungeon/maze/tunnel style of display with a perspective-rendered corridor - there's a version of the infinite corridor trick done by video frames … I want to model the walls and place objects in the corridor or decorate the walls with things in a seamless way so that it looks 3D.

The other is the trick I've been working on this week to shade spheres (or rather circles!) so that they look like they're dynamically lit, and renderred on the fly, even though they're not. It helps a lot that planets always revolve around the polar axis, so for a revolving planet one cycle of animation is perfect and can be displayed at any rotation.

Drawing shadows on a sphere is tricky. I had a good solution using a video of only the shadows, but it's bulky - and I have not been able to get a good set of frames with transparency at the correct density. (I've been doing a lot of tweaking with ImageMagick but it's an annoyingly tweaky program!)

I finally settled on using the pen. DadOfMtLog had a good shading algorithm but it wasn't transparency-friendly and couldn't easily be made so. So I created a new one which (for speed) draws the shaded area with one horizontal line, then draws 6 short line segments in decreasing shades to render the fuzzy edge of the terminator, then draws the unshaded area in one final almost-transparent line. So it's about fast enough for animation - I haven't worked on speed yet, still getting the functionality right… (see request above for problems with my pen rendering)

So with this trick I should be able to code a space-sim fly-by of any planet from any viewpoint with realistic sun illumination. Turns out there are a bunch of videos on Youtube of rotations of all the planets that can be used. It ought to be quite impressive! I have a studio for ‘procedural universe generators’ and I hope to marry up a proper star background along with the actual planets and their moons in the right positions…

(In my ‘to do’ list after getting the basics working, is to add realistic animated clouds, and an atmosphere around the planet as seen from space - there are some great NASA photographs to work from and the EPIC animation of Earth seen from the Lagrange point beyond the moon)

G
PS The three different techniques I've tried so far, side by side to compare:

https://scratch.mit.edu/projects/114616806/ - moving a gaussian blur horizontally across the planet. Shading of the planet looks good, but the terminator is just wrong.

https://scratch.mit.edu/projects/114616806/ - using a video of shading on top of a video of unshaded planet - looks great except I don't yet have a good video of shading to use. I may have to render the shadows as sprites myself to get the values I want. Doing so would also allow better surface shading more like the previous example.

https://scratch.mit.edu/projects/114830002/ - pen drawn shadows - apart from rendering bug, this only works for an equitorial light source. Will need different transparency-friendly drawing algorithm for other orientations. Only handles the terminator, doesn't allow for subtle surface shading

Last edited by gtoal (June 25, 2016 17:46:06)

Layzej
Scratcher
100+ posts

Non-photorealistic rendering projects

NPR inspiration. Click before and after buttons: https://www.filterforge.com/filters/10787.html
Layzej
Scratcher
100+ posts

Non-photorealistic rendering projects

RGB Untethered:

Last edited by Layzej (July 28, 2016 20:31:53)

Rumanti
Scratcher
1000+ posts

Non-photorealistic rendering projects

Layzej wrote:

RGB Untethered

Beautiful effect! Why are the edges more “edited” compared to the inner parts, though ?

:wq
Layzej
Scratcher
100+ posts

Non-photorealistic rendering projects

Rumanti wrote:

Beautiful effect! Why are the edges more “edited” compared to the inner parts, though ?

The effect is exaggerated further from the nose and muted towards the middle. That way there is a focal point where the image is coherent.

You can modify the ‘squig’ variable to something constant over the whole image if you like. A larger ‘squig’ will create a wilder result.
PullJosh
Scratcher
1000+ posts

Non-photorealistic rendering projects

I was poking around a bit today and created a new NPR project which twists the image. It looks pretty funny. :3 Unfortunately, I'm unable to save any projects online, which means I can't upload the project.

I've got it hosted here. Would someone be willing to upload it for me on their account?

NVM, Jonathan50 found a solution.

Last edited by PullJosh (Sept. 3, 2016 00:43:48)

gtoal
Scratcher
1000+ posts

Non-photorealistic rendering projects

Looks like one of the sprite effects recreated in pen!

It times out when saving changes to the web site for me too. Sorry.
PullJosh
Scratcher
1000+ posts

Non-photorealistic rendering projects

gtoal wrote:

Looks like one of the sprite effects recreated in pen!

It times out when saving changes to the web site for me too. Sorry.
Very strange stuff… The bug appears to affect projects which are uploaded from your computer, as well as projects created with File > Make a copy. I'll make a bug report if the issue continues…
Jonathan50
Scratcher
1000+ posts

Non-photorealistic rendering projects

Try uploading it using the offline editor.

Not yet a Knight of the Mu Calculus.
PullJosh
Scratcher
1000+ posts

Non-photorealistic rendering projects

Jonathan50 wrote:

Try uploading it using the offline editor.
Aha! That worked great.
novice27b
Scratcher
1000+ posts

Non-photorealistic rendering projects

This looks like it could be very useful: https://github.com/fogleman/primitive

i use arch btw
WooHooBoy
Scratcher
1000+ posts

Non-photorealistic rendering projects

bump!

I found this thing that isn't NPR but it's still cool and maybe you guys could take something out of it https://github.com/mxgmn/WaveFunctionCollapse

considered harmful
PullJosh
Scratcher
1000+ posts

Non-photorealistic rendering projects

WooHooBoy wrote:

I found this thing that isn't NPR but it's still cool and maybe you guys could take something out of it https://github.com/mxgmn/WaveFunctionCollapse
That looks sweet!
gtoal
Scratcher
1000+ posts

Non-photorealistic rendering projects

WooHooBoy wrote:

bump!

I found this thing that isn't NPR but it's still cool and maybe you guys could take something out of it https://github.com/mxgmn/WaveFunctionCollapse

Hmmm… This is very similar to ‘inpainting’…

G
PullJosh
Scratcher
1000+ posts

Non-photorealistic rendering projects

I'd say this project counts as NPR.

It generates stereograms such as this one:


If anybody knows how to make it faster, that would be sweet.
ilikelegos
Scratcher
100+ posts

Non-photorealistic rendering projects

PullJosh wrote:

I'd say this project counts as NPR.

It generates stereograms such as this one:

If anybody knows how to make it faster, that would be sweet.

Ooh, at that size I could actually do it the right way and not flip the depth.

Hi! I'm a computer science student who learned coding on Scratch!
ilikelegos
Scratcher
100+ posts

Non-photorealistic rendering projects

Kinda topic-related… -ish: I've been messing around with shaders in the godot game engine.
They're pretty cool! Bit of a learning curve (Coming form no shaders experience) but I think I made a decent little “Hologram/Old moniter” shader.

Unfortunely I can't figure out how to provide an image from the right file type so…
Anyways, they're cool.

Hi! I'm a computer science student who learned coding on Scratch!

Powered by DjangoBB