This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#26 2009-01-25 02:51:52

RUMCHEERYPOOPOO
Scratcher
Registered: 2008-12-23
Posts: 100+

Re: How the 3d line import and render works.

vertices:

Code:

1.186841
1.184794
-0.958061
1.186841
1.184794
-0.964472
1.186841
1.175432
-0.964472
1.207944

and lines

Code:

1
2
1
5
4
6
1
4
4
7

but It has got alot of lines say 10,000


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#27 2009-01-25 03:11:23

RUMCHEERYPOOPOO
Scratcher
Registered: 2008-12-23
Posts: 100+

Re: How the 3d line import and render works.

also I tried doing it with a cube once and it worked and now it doesn't???
it does the exact same thing with just a dot in the middle.
I'm suprised you can't load it as for me it just takes along time


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#28 2009-01-26 17:35:48

AddZero
Scratcher
Registered: 2007-08-11
Posts: 100+

Re: How the 3d line import and render works.

They look good to me.
You might try re-downloading my project and import those lists again.
It might be that your file corrupted or changed somehow.
That's my best guess.


http://scratch.mit.edu/static/icons/buddy/524717_med.png?t=2010-06-15+09%3A48%3A36

Offline

 

#29 2009-01-27 11:21:30

RUMCHEERYPOOPOO
Scratcher
Registered: 2008-12-23
Posts: 100+

Re: How the 3d line import and render works.

thanks going to try it now


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#30 2009-01-27 11:41:30

RUMCHEERYPOOPOO
Scratcher
Registered: 2008-12-23
Posts: 100+

Re: How the 3d line import and render works.

It works thanks  smile
but how would you make it bigger it is quite small


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#31 2009-01-27 12:45:22

AddZero
Scratcher
Registered: 2007-08-11
Posts: 100+

Re: How the 3d line import and render works.

That's cool it works, Like I wrote on your project, compare with my '3d desk' project.  There's a zoom control there.
Actually, I think the '3d desk' drawer is a bit more stable than the Suzanne one.  The hiding controls never worked quite right.  The depth shading with Suzanne is neat, but could have been written better.  But other then those points, they're the same.


http://scratch.mit.edu/static/icons/buddy/524717_med.png?t=2010-06-15+09%3A48%3A36

Offline

 

#32 2009-03-07 09:55:03

NXTGeek
Scratcher
Registered: 2008-03-27
Posts: 100+

Re: How the 3d line import and render works.

I found a way to make a 3D "wheel" to control rotation. its i little better tha nscratch's sliders

Offline

 

#33 2009-06-27 11:16:08

jellytelly
Scratcher
Registered: 2008-12-23
Posts: 9

Re: How the 3d line import and render works.

I am having problems Addzero, I added a pen to draw, but I don`t know what to do next.
[blocks]<say[ help ]for( 10 )secs>[/blocks]
:-(
[blocks]<hide>[/blocks]

Offline

 

#34 2010-01-09 16:32:30

AddZero
Scratcher
Registered: 2007-08-11
Posts: 100+

Re: How the 3d line import and render works.

I needed to mention this here:
RHY3756547 wrote an excellent ".OBJ Reader" project, this could greatly simplify importing 3d models into scratch.
http://scratch.mit.edu/projects/RHY3756547/770414

hi jellytelly, sorry for the slow response.  the next step is 3d projection- translating your 3d data (x, y, z) into your 2d screen (x, y).  another RHY3756547 project tried to explain how it works: http://scratch.mit.edu/projects/RHY3756547/799909


http://scratch.mit.edu/static/icons/buddy/524717_med.png?t=2010-06-15+09%3A48%3A36

Offline

 

#35 2011-07-26 02:07:27

cheddargirl
Scratch Team
Registered: 2008-09-15
Posts: 1000+

Re: How the 3d line import and render works.

reopened by request of owner


http://i.imgur.com/8QRYx.png
Everything is better when you add a little cheddar, because when you have cheese your life is at ease  smile

Offline

 

#36 2011-07-26 04:51:37

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: How the 3d line import and render works.

My goodness I somehow missed this before! This is very exciting! I was going to offer to make an online php parser to turn the blender system into one Scratch can read. What does the file look like if you export the entire shape, not just the wireframe? It might be an idea to get the parser to optionally filter out everything but the wireframe which would make exporting from Blender faster?

I would also suggest putting both values into one file rather than two with a separator character on one line such as '%' Only one .txt file will then need importing and the Scratch project can take a moment when the project starts to seperate the file into two lists if it's not done it yet.

I've seen a wireframe drawing of a computer desk, monitor and chair - oh, it's yours  tongue  Well I guess you know that the flash player allows more complex wireframes then  wink


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#37 2011-07-26 05:34:33

RUMCHEERYPOOPOO
Scratcher
Registered: 2008-12-23
Posts: 100+

Re: How the 3d line import and render works.

Sparks - This is the default cube.

With faces:

Code:

# Blender v2.58 (sub 0) OBJ File: ''
# www.blender.org
o Cube
v 1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v -1.000000 -1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v 1.000000 1.000000 -0.999999
v 0.999999 1.000000 1.000001
v -1.000000 1.000000 1.000000
v -1.000000 1.000000 -1.000000
f 1 2 3 4
f 5 8 7 6
f 1 5 6 2
f 2 6 7 3
f 3 7 8 4
f 5 1 4 8

Without faces:

Code:

# Blender v2.58 (sub 0) OBJ File: ''
# www.blender.org
o Cube
v 1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v -1.000000 -1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v 1.000000 1.000000 -0.999999
v 0.999999 1.000000 1.000001
v -1.000000 1.000000 1.000000
v -1.000000 1.000000 -1.000000
f 1 2
f 1 4
f 1 5
f 2 3
f 2 6
f 3 4
f 3 7
f 4 8
f 5 6
f 5 8
f 6 7
f 7 8

As you can see, the one with faces has more numbers after each 'f' this is because if you had a straight line for example, it would only require 2 points (start and end) to define it, whereas with faces, it requires four points (in this case the faces are quads, if they were tris they would have 3 numbers.

Each number tells us which vertex (the numbers with a 'v' before them) it starts at and then where the other points are. So "f 1 2" would mean a line (2 points) that starts at vertex 1 (1.000000 -1.000000 -1.000000) and ends at vertex 2 (1.000000 -1.000000 1.000000).

A thing to note: the vertices' coordinates are in the order x y z (I think Z is up but please correct me if I'm wrong Actually maybe it is Y, honestly I'm not sure  big_smile ).

Final Edit: I would like to thank addzero/jtxt for introducing me to blender all those years ago, I love it!

Last edited by RUMCHEERYPOOPOO (2011-07-26 05:53:46)


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#38 2011-07-26 06:09:52

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: How the 3d line import and render works.

So is it worth me putting together a php parser for this? It shouldn't take long.

EDIT: I should really get blender...

Last edited by sparks (2011-07-26 06:10:08)


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#39 2011-07-26 06:15:13

RUMCHEERYPOOPOO
Scratcher
Registered: 2008-12-23
Posts: 100+

Re: How the 3d line import and render works.

sparks wrote:

So is it worth me putting together a php parser for this? It shouldn't take long.

EDIT: I should really get blender...

To be able to change it into a scratch friendly format?

If you want.


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#40 2011-08-11 13:10:59

loolo78
Scratcher
Registered: 2011-03-11
Posts: 41

Re: How the 3d line import and render works.

Paddle2See wrote:

As promised, here is a script in Python that will parse vertex and line files from your blender files.  I'm a bit of a newbie in Python so don't make fun of it...there's probably a way to do it in two lines, if you know what you're doing.  But, it should work and that's what counts.  Adjust the file paths to fit your environment.

Code:

# Define file paths as a raw string and every kind of catalog well work, else some catalog with sensitive characters won't work.

Infile = "c:\users\owner\desktop\Blender Data File.txt"
Outfile1 ="c:\users\owner\desktop\Vertices.txt"
Outfile2 ="c:\users\owner\desktop\Lines.txt"

# Open files

vertices = open(Outfile1,'w')   
lines =    open(Outfile2,'w')
inp =      open(Infile,'r')

# Process the input file, one line at a time

for input_line in inp:
    
    field = input_line.split()   # Split line into fields on whitespace
    
    if field[0].startswith('v'):            # Lines that start with "v"
        vertices.write(field[1]+'\r\n')     # Adding Return and Newline chars
        vertices.write(field[2]+'\r\n')
        vertices.write(field[3]+'\r\n')
        
    if field[0].startswith('f'):            # Lines that start with "f"
        lines.write(field[1]+'\r\n')
        lines.write(field[2]+'\r\n')

# Close all the files

vertices.close()
lines.close()
inp.close()

The catalog wouldn't work so well if you don't add a 'r' at the front to make it raw string. And what is '\s', all i know is that it makes the outputs returns not work, it looks good at first but then if you try to import it in to scratch then the problem will show, every line's return is glitched out. if you go back to the file and save it, every return will reveal it's glitch so i have change it in to a right return with '\n'.

a better version with the catalog bug fixed would be

Code:

# Define file paths

Infile = r"c:\your own catalog"
Outfile1 =r"c:\your own catalog2"
Outfile2 =r"c:\your own catalog3"

# Open files

vertices = open(Outfile1,'w')   
lines =    open(Outfile2,'w')
inp =      open(Infile,'r')

# Process the input file, one line at a time

for input_line in inp:
    
    field = input_line.split()   # Split line into fields on whitespace
    
    if field[0].startswith('v'):            # Lines that start with "v"
        vertices.write(field[1]+'\n')     # Adding Return and Newline chars
        vertices.write(field[2]+'\n')
        vertices.write(field[3]+'\n')
        
    if field[0].startswith('f'):            # Lines that start with "f"
        lines.write(field[1]+'\n')
        lines.write(field[2]+'\n')

# Close all the files

vertices.close()
lines.close()
inp.close()

Last edited by loolo78 (2011-08-11 14:12:09)


Around The World
http://www.danasoft.com/sig/loolo78.jpg

Offline

 

#41 2012-03-24 20:09:29

Jamohyperturbopro
Scratcher
Registered: 2009-06-25
Posts: 8

Re: How the 3d line import and render works.

This is a very cool idea. I spent a few weekends working on making it possible to edit 3D models in scratch. Currently I have a program that can import and export .obj files and a native list archive format, edit lines and delete vertices, and, with some extra data per line, cull lines facing away from the camera.
There is still a lot of work to do, though.

I hope the program will make it easier to port 3D models for use in 3D games.
http://scratch.mit.edu/projects/Jamohyperturbopro/2419116
You can test out the Import function on the project's page

Last edited by Jamohyperturbopro (2012-03-26 06:19:30)

Offline

 

#42 2012-05-15 11:45:13

iTweak0r
Scratcher
Registered: 2011-07-30
Posts: 100+

Re: How the 3d line import and render works.

when i tryed doing it, it just made crazy lines

i think it is because your lines file looks like this

3
5
7
7
8
9
5
3...

but mine:

3n4
5n2
5n8
8n3...


please tell me how to fix this!


Make it in Scratch! because it's cooler when it's made in scratch
http://i.imgur.com/D4iqPHR.png

Offline

 

#43 2012-05-16 04:35:33

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: How the 3d line import and render works.

Are you using Blender?


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#44 2013-01-08 10:44:15

FarAwayGames
Scratcher
Registered: 2013-01-07
Posts: 1

Re: How the 3d line import and render works.

lol I was to lazy to do all the file splitting and I was in Windows 7, so I restarted my computer and booted into Ubuntu  tongue

Offline

 

#45 2013-03-11 21:01:47

estile
Scratcher
Registered: 2013-01-26
Posts: 100+

Re: How the 3d line import and render works.

i wonder if i can make this work for goggle sketchup......
it wouldnt be too hard to write a scratch program that separates the list and gets rid of the v's and l's


http://i45.tinypic.com/s4nvxl.png

Offline

 

#46 2013-03-21 18:00:17

qwerts9000
Scratcher
Registered: 2011-02-21
Posts: 100+

Re: How the 3d line import and render works.

Nice!

Offline

 

#47 2013-03-24 03:53:00

newnewfew
Scratcher
Registered: 2013-02-23
Posts: 68

Re: How the 3d line import and render works.

I think I'm necroposting but your projects are 1.3.


It's contest time!
http://scratch.mit.edu/projects/newnewfew/3218957

Offline

 

#48 2013-03-24 04:00:02

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: How the 3d line import and render works.

newnewfew wrote:

I think I'm necroposting but your projects are 1.3.

Yeah you kinda were  tongue  but you're not the first one if that gives you any consolation  wink

And not the last...

Offline

 

Board footer