Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Work in progress - fake lighting for a pumpkin project

alnisalnis Member, Developers Posts: 452 EDU
I'm currently working on faking some lighting for a pumpkin modeling project, and I figured I should share my progress along the way.

Right now, I'm trying to get the lighting to look good, and then I'll work on a more generalized solution for all sorts of lit backgrounds and objects. Hopefully, I'll eventually turn it into a custom feature once I'm done (it's currently just a bunch of patterned variables and other features). The light falloff is currently linear since I was having trouble getting an inverse square falloff to look good. I think that the end solution will be to have an inverse square falloff from lighting sources, but also a final logarithmic transformation of the color to get it to look good and enhance the dynamic range of the image. That will make the coloring behave more like a typical 3D rendering engine, camera, or human eye.

In any case, without further ado, here is a first gif of the scene (everything is WIP, the final will look much better):


As I've been working on this, I realized it would be nice to have a "flat" view mode where simply solid colors are displayed (no specularity). This would add some extra artistic freedom, and it would also give another option when taking screenshots for documentation and/or printing (something between an edges-only view and a shaded view), maybe like this mockup I made in Blender:

Get in touch: contact@alnis.dev | My personal site: https://alnis.dev
@alnis is my personal account. @alnis_ptc is my official PTC account.

Comments

  • EvanReeseEvanReese Member, Mentor Posts: 2,186 ✭✭✭✭✭
    @alnis_smidchens
    what's going on here? looks like some awesome craziness! 
    Evan Reese
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,714
    I guess you've split that surface into hundreds of rings and changed the colour of each? You crazy!
    Senior Director, Technical Services, EMEAI
  • alnisalnis Member, Developers Posts: 452 EDU
    @NeilCooke guessed it! To make things easy to manipulate, the color is set by a function in the feature pattern. Here is a screenshot of the full feature tree:

    Get in touch: contact@alnis.dev | My personal site: https://alnis.dev
    @alnis is my personal account. @alnis_ptc is my official PTC account.
  • EvanReeseEvanReese Member, Mentor Posts: 2,186 ✭✭✭✭✭
    you monster! what's your rebuild time?
    Evan Reese
  • alnisalnis Member, Developers Posts: 452 EDU
    Currently 9.71 seconds, but I have a feeling I could improve/optimize it a lot more. (it's also calculating 100 steps in this example)

    Get in touch: contact@alnis.dev | My personal site: https://alnis.dev
    @alnis is my personal account. @alnis_ptc is my official PTC account.
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,714
    @alnis_smidchens you need to learn FeatureScript 🤪
    Senior Director, Technical Services, EMEAI
  • alnisalnis Member, Developers Posts: 452 EDU
    @NeilCooke Absolutely! :D At this point, I really have no excuses.
    Get in touch: contact@alnis.dev | My personal site: https://alnis.dev
    @alnis is my personal account. @alnis_ptc is my official PTC account.
  • mahirmahir Member, Developers Posts: 1,309 ✭✭✭✭✭
    This is a cool thought experiment, but I'm wondering how useful it is to fake basic photo renderering capabilities into OS vs just using a separate photo renderer like Blender, Owlet, or LuxRender?
  • EvanReeseEvanReese Member, Mentor Posts: 2,186 ✭✭✭✭✭
    @alnis_smidchens you are basically already doing the hard part of featurescript, which is deciding what you want to do, lol! 

    @mahir this lighting workflow is certainly of dubious utility, and given that Alnis made this animation, it strikes me as a curious passion project or quarantine insanity, to which I say shine on you crazy diamond!

    Evan Reese
  • alnisalnis Member, Developers Posts: 452 EDU
    @mahir It's really just for fun. Not at all for utility, just like @Evan_Reese guessed! I had the idea of making a CAD model of a pumpkin with this sort of translucent/3D carving (not mine, just something I found on the web):
    Saturns Shooting Star - Cassini Pumpkin by johwee on DeviantArt
    I figured it would be a fun project to figure out how to have the different depths of cut have different face colors to simulate that sort of glow, so I decided to start with some simpler lighting projects and then move up in scale/difficulty. Hopefully, I'll eventually write a custom feature to help automate some of it, but first, I need to just get it working in a regular model!
    Get in touch: contact@alnis.dev | My personal site: https://alnis.dev
    @alnis is my personal account. @alnis_ptc is my official PTC account.
  • EvanReeseEvanReese Member, Mentor Posts: 2,186 ✭✭✭✭✭
    This may or may not be related to how you're wanting to go about it, but I've been curious about converting bitmap data to usable data in featurescript. My current understanding is that it can't be done within FS, but with something like Python one could create a .csv of the pixel data, or points sampled from the image, which could then be used to drive whatever you want, like color, or cut depth or anything. I'd like to eventually make it a separate mode for Attractor Pattern, so I could just make a black and white image of some texture and map that to a pattern on a 3D body. I don't know Python (or anything else) and probably won't get around to it anytime soon, but if someone more capable is interested, I'd welcome a collaboration.

    On the other hand, maybe you could just modify the extrude feature so that it also colors the end cap faces according to depth as a % of the total substrate thickness. Then you could make the art in some vector software and import a dxf as your base sketch.
    Evan Reese
Sign In or Register to comment.