Discuss Scratch

-AI-
New to Scratch
9 posts

Non-photorealistic rendering projects

Can someone help me fix the (hopefully) very obvious bug in my code that I missed?
Right now, the problem is with the compression and decompression of the variables (I think).
The project is here.

Possibly the most silent reader on the forums.
MartinBraendli2
Scratcher
100+ posts

Non-photorealistic rendering projects

-AI- wrote:

Can someone help me fix the (hopefully) very obvious bug in my code that I missed?
Right now, the problem is with the compression and decompression of the variables (I think).
The project is here.

Rule of thumb: Don't use any base, that isn't base-2^n. Dont! The conversion will be slow (and you might make mistakes). If you use other bases, use eigher:
- Base64. I used it here, have a look at the Sprites “I/O” and “base64”
- Base16/Hexadecimal. I use it all the time. There are ways to get more information into a single character (Base64 gets 50% more), but its super simple and fast to convert, especially since Scratch can easily convert from Hex to decimal.
set [ encoded v] to [2AFF3D]
set [dec v] to ((1) * (join [0x] [(encoded)]))
Also, hexadecimal can be used in cloud variables. So unless you have a really good reason, don't use other bases.

To get a hex string from an image go to https://tegmen.github.io/imgToHex/ (doesn't work well with chrome, use for example Firefox).
To get a list with colors:
set [i v] to [1]
repeat ((width) * (height))
add (join (join (join (join (join [0x] (letter (i) of (encoded))(letter ((i) + (1)) of (encoded))) (letter ((i) + (2)) of (encoded))) (letter ((i) + (3)) of (encoded))) (letter ((i) + (4)) of (encoded))) (letter ((i) + (5)) of (encoded))) to [image v]
change [i v] by (6)
end

awesome-llama
Scratcher
1000+ posts

Non-photorealistic rendering projects

Layzej wrote:

Output from the latest project in the studio: https://scratch.mit.edu/projects/163744280/

Cool!

██████████████████
█████████████████████████
█████
██████
████
███
█████
██
███
███
██
██
██
██
█████████
█████████
████████████████████████
My llama looks weird
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████
█████████████████████
█████████████████████
███████████████████
██████████████████████
████████████████████████
█████████████████████
██████████████████
███████████████████
████████████


-AI-
New to Scratch
9 posts

Non-photorealistic rendering projects

MartinBraendli2 wrote:

Rule of thumb: Don't use any base, that isn't base-2^n. Dont! The conversion will be slow (and you might make mistakes). If you use other bases, use eigher:
- Base64. I used it here, have a look at the Sprites “I/O” and “base64”
- Base16/Hexadecimal. I use it all the time. There are ways to get more information into a single character (Base64 gets 50% more), but its super simple and fast to convert, especially since Scratch can easily convert from Hex to decimal.
set [ encoded v] to [2AFF3D]
set [dec v] to ((1) * (join [0x] [(encoded)]))
Hmm… makes sense…
Does scratch have a built in for dec to hex the way you show it has hex to dec?
Would make encoding easier.

Possibly the most silent reader on the forums.
-AI-
New to Scratch
9 posts

Non-photorealistic rendering projects

Oh. Actually base 16 doesn't compress the data enough, and Scratch won't save.

Possibly the most silent reader on the forums.
Layzej
Scratcher
100+ posts

Non-photorealistic rendering projects

Layzej wrote:

Here's my go at it:

I've made this one in real life:

NickyNouse
Scratcher
1000+ posts

Non-photorealistic rendering projects

Layzej wrote:

Layzej wrote:

Here's my go at it:

I've made this one in real life:

thAT IS SO COOL
well done!
Rumanti
Scratcher
1000+ posts

Non-photorealistic rendering projects

Layzej wrote:

Here's my go at it:
-snip-

Whoa, that's really interesting! I've never seen anything like this before.

Is there a particular name/algorithm for this kind of NPR?

:wq
Layzej
Scratcher
100+ posts

Non-photorealistic rendering projects

NickyNouse wrote:

[
thAT IS SO COOL
well done!

Thx!
Layzej
Scratcher
100+ posts

Non-photorealistic rendering projects

Rumanti wrote:

Layzej wrote:

Here's my go at it:
-snip-

Whoa, that's really interesting! I've never seen anything like this before.

Is there a particular name/algorithm for this kind of NPR?

It's in the style of petros vrellis “a new way to knit” - http://artof01.com/vrellis/works/knit.html
MartinBraendli2
Scratcher
100+ posts

Non-photorealistic rendering projects

Layzej wrote:

I've made this one in real life:

Looks Great!
Did you write an new script to show you a step by step instruction? How long did it take you?

Layzej
Scratcher
100+ posts

Non-photorealistic rendering projects

MartinBraendli2 wrote:

Did you write an new script to show you a step by step instruction? How long did it take you?

I just added a line to the existing project to save each step to a list. I had to re-calibrate though because the thread in the original project is much lighter than real black thread. I got about 1500 stitches in before I realized, re-calibrated, and started over. The final project is only 900 stitches (though I may add 100 more to give more definition to the nose). The whole project took about a week to complete.

gtoal
Scratcher
1000+ posts

Non-photorealistic rendering projects

I love when this stuff crosses over into the real world!

The ultimate validation of course is if you can sell it… Etsy, anyone? :-)

Also it would make a good Instructable, if you use that site. (Write it up and have it ready to release next time they have an appropriate competition…)

G
NitroCipher
Scratcher
500+ posts

Non-photorealistic rendering projects

Is there a starter project that has the NPR guy as a long list of hex numbers? (row by row, top to bottom)

when flag clicked //hopefully run like this
set [i v] to [0]
pen up
clear
set y to (180)
repeat (360)
set x to (-240)
pen down
repeat (480)
change [i v] by (1)
set pen color to ((join[0](item (i) of [image v]))*(1))
change x by (1)
end
change y by (-1)

Last edited by NitroCipher (Nov. 28, 2017 20:57:06)


I hope my post helped you in some way! Post count: 500+

Current project: [s3Blocks: scratchblocks rewritten for Scratch 3.0] ::#4b4a60 //https://scratch.mit.edu/discuss/topic/290031/ Basically done!
This is my signature identifier “aWFtbml0cm9jaXBoZXI=”
Layzej
Scratcher
100+ posts

Non-photorealistic rendering projects

NitroCipher wrote:

Is there a starter project that has the NPR guy as a long list of hex numbers? (row by row, top to bottom)

Maybe this one by Chooper: https://scratch.mit.edu/projects/77685662
Wettining
Scratcher
500+ posts

Non-photorealistic rendering projects

Layzej wrote:

Layzej wrote:

Here's my go at it:

I've made this one in real life:

How long did that take you
Layzej
Scratcher
100+ posts

Non-photorealistic rendering projects

chooper100 wrote:

What I do have to say though is that the tool to scan custom images I mentioned here has now been taken completely online.

Yep, that's right. It even has a few more options, such as being able to resize the image.

You can access the tool at <broken link>.

Does anyone know of an online pic->list converter? The Chooper one is no more
Layzej
Scratcher
100+ posts

Non-photorealistic rendering projects

Here's a non-photorealistic rendering of a 3d model of the NPR guy:



I
Layzej
Scratcher
100+ posts

Non-photorealistic rendering projects

I tried posting the stf file here, but…

“Ensure this value has at most 200000 characters (it has 942005).”
Rhodare
Scratcher
100+ posts

Non-photorealistic rendering projects

I can’t believe this thread is still going XD

Check out my pixel landscape :D https://scratch.mit.edu/projects/115561401/

Powered by DjangoBB