Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Textures and Images #218

Open
noio opened this issue Dec 13, 2013 · 17 comments
Open

Textures and Images #218

noio opened this issue Dec 13, 2013 · 17 comments

Comments

@noio
Copy link
Contributor

noio commented Dec 13, 2013

Being able to not just color objects but texture them too would be really nice. LCL could have some 'stock' images included or load them from user-provided URL's. Basic patterns with some tinting/recoloring could give a huge array of options already.

Have you guys ever discussed something like this?

Another option would be to have a kind of texture-definition sublanguage:

material = 
    background red
    blue circle

Even crazier: http://threejs.org/examples/#webgl_materials_video, but kind of useless unless the user could load youtube videos or something.

P.S. I held off on posting a new issue until I fixed an old one, haha. 🎩

@davidedc
Copy link
Owner

One option I'd like is to specify textures via fill so it would look like

fill "image.png" // image or shader name
box
noFill
fill "shaderName"
fillParams color(r,g,b,a), time, color(r,g,b), color(r,g,b,a) // this will be passed to the shader
tint color(r,g,b)
peg
noFill
ball
noTint
rect

of course one should be able to set a particular combination of fill image and tint via another function, and it should be possible to push/pop fills and tints in a state stack just like the matrix, so it's possible to have local materials.

So this would work: (in fact I'd like to get this to work just for standard fills quite soon, as the language already supports all of this apart from having the stack for the fills):

localMaterial = (drawingCode) ->
  pushFill
  pushTint
  fill "shaderName"
  drawingCode()
  popTint
  popFill

localMaterial <box peg 1.1 time rotate ball>
box // not affected by local material

localMaterial
  ...a bunch of code here...

peg // not affected by local material

(note that tint and noTint exist in processing, but we don't have them yet)

@davidedc
Copy link
Owner

p.s. localMaterial <box peg 1.1 time rotate ball> is just same as localMaterial -> box peg 1.1 time rotate ball

@Richard-Mineall
Copy link

hmm, this seems a little challenging but if people could get the embed code for a youtube video, it would be easy to display

@xinaesthete
Copy link

I thought there was an XSS restriction on loading data from other domains as texture.

@Richard-Mineall
Copy link

Oh, I forgot about that but if we could get images to work a video might,
but it would need to be downloaded instead of put in as an embed code

On Tue, Feb 3, 2015 at 11:40 AM, Peter Todd [email protected]
wrote:

I thought there was an XSS restriction on loading data from other domains
as texture.


Reply to this email directly or view it on GitHub
#218 (comment)
.

@xinaesthete
Copy link

Yes I agree, video should be able to work and wouldn't be much more difficult in principle than images. If there were a server proxy, then YouTube etc could work as well.

I do heartily support the idea of supporting different shaders and think @davidedc's suggestion seems like a decent start. Would probably want to address shader uniforms by name.

My memory is that the materials were fairly buggy, doing fill colour with any reasonably complex program would start to go wrong pretty often in my experience. That may have improved with some of the recent changes I haven't kept up with... anyway, should be a separate issue really (maybe it already is).

@xinaesthete
Copy link

It could be that my experience with buggy materials were related to other material-related changes in my fork.

@Richard-Mineall
Copy link

An fps lock would be good for this it can't go up or down, that would
definitely fix the problem, as well as any lag that is present

On Tue, Feb 3, 2015 at 11:57 AM, Peter Todd [email protected]
wrote:

Yes I agree, video should be able to work and wouldn't be much more
difficult in principle than images. If there were a server proxy, then
YouTube etc could work as well.

I do heartily support the idea of supporting different shaders and think
@davidedc https://github.com/davidedc's suggestion seems like a decent
start. Would probably want to address shader uniforms by name.

My memory is that the materials were fairly buggy, doing fill colour with
any reasonably complex program would start to go wrong pretty often in my
experience. That may have improved with some of the recent changes I
haven't kept up with... anyway, should be a separate issue really (maybe it
already is).


Reply to this email directly or view it on GitHub
#218 (comment)
.

@Richard-Mineall
Copy link

With downloaded images and/or videos, it should be able to work, I don't think that it would be buggy as the image is already fully loaded on your computer. I think it wouldn't be necessary to lock the fps, except for crazy things like my flashing grid, so we should just put in .pdf file support, work on .gif files, and then try for videos, I might try a little experiment in a little copy of livecodelab I made for my computer, it's just a downloaded version of the website, but can be played offline, and I think it might run on tablets and things like Chromebooks, which is what I'm on right now, even offline, because the whole thing works offline (well, everything but the demos and tutorials)

@Richard-Mineall
Copy link

I think that we should be able to load images that we have downloaded to
our computers by typing in the name that we have set for it on our
computer, such as a picture I took of some braze welds I did I named it
Welds and the file name is: "Welds.jpg" and by typing it in, it should load
the image, and this might help with lag as well, as it is referencing a
downloaded file instead of a file form the internet, and that negates the
XSS restriction as well, Videos might work but It would definitely create
lag, sounds might as well, but it would be a cool edition

On Tue, Feb 3, 2015 at 12:02 PM, Richard Layton <
[email protected]> wrote:

An fps lock would be good for this it can't go up or down, that would
definitely fix the problem, as well as any lag that is present

On Tue, Feb 3, 2015 at 11:57 AM, Peter Todd [email protected]
wrote:

Yes I agree, video should be able to work and wouldn't be much more
difficult in principle than images. If there were a server proxy, then
YouTube etc could work as well.

I do heartily support the idea of supporting different shaders and think
@davidedc https://github.com/davidedc's suggestion seems like a decent
start. Would probably want to address shader uniforms by name.

My memory is that the materials were fairly buggy, doing fill colour
with any reasonably complex program would start to go wrong pretty often in
my experience. That may have improved with some of the recent changes I
haven't kept up with... anyway, should be a separate issue really (maybe it
already is).


Reply to this email directly or view it on GitHub
#218 (comment)
.

@davidedc
Copy link
Owner

sounds cool give it a shot!

@Richard-Mineall
Copy link

I'll do my best, my computer still has a problem running the master program

On Fri, Apr 24, 2015 at 8:10 AM, Davide Della Casa <[email protected]

wrote:

sounds cool give it a shot!


Reply to this email directly or view it on GitHub
#218 (comment)
.

@Richard-Mineall
Copy link

I made it work using the inspect element feature in chrome, It looks pretty
good, and I even got a video to run on a sphere, I think I might be able to
make it cinematic 3D as well, if we could add that in, but it will lag a
little bit.

On Fri, Apr 24, 2015 at 11:01 AM, Richard Mineall Layton <
[email protected]> wrote:

I'll do my best, my computer still has a problem running the master program

On Fri, Apr 24, 2015 at 8:10 AM, Davide Della Casa <
[email protected]> wrote:

sounds cool give it a shot!


Reply to this email directly or view it on GitHub
#218 (comment)
.

@davidedc
Copy link
Owner

davidedc commented May 6, 2015

Great news man! Richard please do share the code here or on a gist, no matter how provisional it is... more hands make light work. If you put in a Gist I can help out and we can revision it there until we can merge something...

@Richard-Mineall
Copy link

All I did was replace one of the colors with a image file, and then with a
video, It just needs to have the ability to reference it from the computers
files, and I don't know exactly how to do that, but all that I did was put
the .url from the image into the spot for one of the less useful colors and
it worked with one that was downloaded, but not with one that wasn't
downloaded, I thought I might be able to reference it directly from Google,
but I couldn't, but you should be able to replicate what I did, sorry that
I didn't save what I did before I replaced the hard drive on my computer.

On Wed, May 6, 2015 at 8:21 AM, Davide Della Casa [email protected]
wrote:

Great news man! Richard please do share the code here or on a gist, no
matter how provisional it is... more hands make light work. If you put in a
Gist I can help out and we can revision it there until we can merge
something...


Reply to this email directly or view it on GitHub
#218 (comment)
.

@davidedc
Copy link
Owner

davidedc commented May 6, 2015

pity that. Sounds simple enough, but I have zero time/focus to start this from scratch unfortunately. If you could re-build the example... it would really help to trampoline from something working...

@Richard-Mineall
Copy link

I'll see if I can get it working again, my computer is still being
upgraded so I'm hoping I might be able to actually use the source code
you provided me with, I'm modifying it with inspect element

On 5/6/15, Davide Della Casa [email protected] wrote:

pity that. Sounds simple enough, but I have zero time/focus to start this
from scratch unfortunately. If you could re-build the example... it would
really help to trampoline from something working...


Reply to this email directly or view it on GitHub:
#218 (comment)

Richard Mineall Layton

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants