Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Craft Coaster

edited October 2017 in Codea Craft Posts: 509

The updated code is available on github. It's from the Codea export so contains a few of the craft assets which you don't need to download.

It contains the PseudoMesh code, and a fair few extensions to the inbuilt quat object.

The backdrop is from NASA, but I had to shrink it to use with Codea so you can download it from here.

Video on youtube.


  • SimeonSimeon Admin Mod
    edited October 2017 Posts: 5,782
    Awesome! Can't wait to try this out

    We'll include it in the next version of Codea?

    Also I have a feeling we should be offering native versions of your what extensions.
  • Posts: 2,728
    @LoopSpace as expected, after seeing the video Awesome!!!!
    Downloaded the space background and replaced the sandy one in the code but crashed Codea! Image 8Mb so tried one of my own smaller images 1.4 Mb also crashed. I'm obviously doing something wrong here. I need to play around with it a little more. Did manage to replace sphere with another model though.
  • Posts: 1,827
    This is incredible, as expected!

    One thing, and maybe it’s just my phone, but it may be that on a mobile device the slats are sometimes hard to see, being relatively thin and short, so it looks like a ball flying around free in space. Perhaps consider making the slats wider and longer?

    Oh and if it’s not totally annoying may I make the observation that if you could add a little bumping animation to the ball, every time it hit a slat, that would sell the illusion like nobody’s business. I don’t know how hard that is though, given that the whole thing looks impossibly hard to me!
  • Posts: 509

    @Bri_G Did you download the backdrop direct from NASA or from the link that I gave? I linked to NASA to give correct attribution, but the version at this location is smaller.

    @UberGoober It looks much better with the Desert Cliff material for the slats but my iPad that is on the beta won't record, and my iPad that will record isn't on the beta so suffers from the Desert Cliff bug.

    I like the idea of making the ball bounce. I'll have a look at how hard it would be.

    As for the difficulty, don't forget that this program was built organically over the 6 (!) years that I've been using Codea. So it started very simple and grew as I thought of new features.

  • Posts: 1,827

    Hey thanks for that note @LoopSpace, you could have just basked in the glory but it's somewhat encouraging to hear everyone started somewhere...

  • Posts: 509

    @UberGoober It's amazing to think back to the early days and my utter ignorance of lua ... but also the fun it was finding out.

    @Simeon Yes! See the quat thread for more of the extensions that I've defined.

    Also, there should probably be a link to the NASA site from the code. If I forget to add one in before you slurp it, can you put one in somewhere suitable? Thanks.

  • Posts: 69
    What did you use for the ball? The built in icosphere, a uv sphere or a nomalized cube?
  • Posts: 2,728

    Hi @LoopSpace , I downloaded the file under the link ‘here’ and the file is 9.4Mb. I also looked at the NASA page from the other link. Confusingly when I downloaded three small files were also downloaded I am assuming they were from the same source. The image was from a Dropbox source and labelled starmap_4K. The other main file was 7884103.png.
    Interestingly I note that the surfaces images contain three associated images normal/colour/AO which I think generate the effects in the visualisation. I have been trying to use a single png file and this may be the reason why Codea is bombing for me - as Craft may be searching for three images.

  • Posts: 509

    @GR00G0 A while back I added various basic shapes as extensions to mesh, when Craft came out I adapted those to models. So it's my own sphere construction - that's included in the code on github.

    @Bri_G You're right about the surfaces being multi-facetted in that way, but you can miss out images and the shader copes fine.

    But I think I messed up. I think I've shared the higher resolution version of the file. Here's the lower res one (and I'll edit the top post with the new URL).

  • Posts: 509

    @Bri_G Just to say - thanks for persisting!

  • Posts: 2,728

    @LoopSpace - thanks for the file, popped it in and working fine. It’s not persistence it’s just enthusiasm to work on code like this, I’m still climbing steep hills when I code and this is like taking the cable car.

  • Posts: 1,827

    That's fantastic, better than I was imagining actually.

  • Posts: 509

    Couple of new videos on twitter, one with AR

  • dave1707dave1707 Mod
    edited October 2017 Posts: 10,053

    A fun thing to do is have an AR program that show a bunch of tarantulas walking around on the floor and give the iPad to someone and have them look around.

    Ps. I’m not responsible if the person throws the iPad.

  • Posts: 1,827

    The AR thing is awesome as well. Yowza. I liked the stars being in there too.

    Sorry to nitpick again, but since you took my other comment and ran with it, and it came out so nice, I thought maybe you'd see merit in this one too: now that the ball's track is solid, what might sell the illusion, just that wee bit more, is seeing the ball cast a shadow on the track.

    Not implying any obligation of course!

  • Posts: 509

    @UberGoober That occurred to me too. Shouldn't be too hard to fake (see my clock video on twitter).

  • Posts: 1,827

    Super sweeet! Looks great, I think it really does sell it.

    I'll have to look up that clock video. Is cast-shadows just not a thing Craft does?

    Peering closely at that road, it appears to be made of lots of little slats. Did you make it by simply reducing a space-between-slats variable to zero?

  • Posts: 509

    @UberGoober Codea might well do shadows, I just haven't figured it out yet. I did wonder about the ray stuff in the physics section, but decided that for these projects then a simple circle would be enough.

    The road is made of lots of little slats, but they are carefully shaped to fit together. The vertices at the joins precisely meet. However, the texture is not great as it's just using one of the standard textures for each face and as they're quite thin then it doesn't look so good. To get it looking good then the texture should be split up over several slats. That's on my list of things to do.

    The other improvement I have in mind is to be able to do half twists, so that as the ball bounces round the track then when it gets back to the start then it is on the other side of the track (like with a Möbius strip). The old code could handle this, but the current code doesn't.

  • SimeonSimeon Admin Mod
    Posts: 5,782

    @LoopSpace @UberGoober Craft doesn't do shadows yet, @john has been working on shadow mapping

Sign In or Register to comment.