Wanted: Package foam

I'm trying to find a shader/material for package cushioning. It has bubbles like soap foam. It just isn't a liquid (or soap). It's the stuff you find in a shipping box that is usually shaped like the negative space of the item being shipped.

Comments

  • WendyLuvsCatzWendyLuvsCatz Posts: 41,753
    edited September 13

    so polystyrene?

    Richard Haseltine will probably affirmate Google Gemini is talking out of its Rsdevil

    Post edited by WendyLuvsCatz on
  • WendyLuvsCatzWendyLuvsCatz Posts: 41,753
    edited September 13

    take this with a heap of scepticism 

     

    AI Overview

     

     

    To create an Expanded Polystyrene (Styrofoam) shader in NVIDIA's Material Definition Language (MDL), you need a Physically Based Rendering (PBR) setup that captures its distinct characteristics. [1, 2]

    A realistic polystyrene shader requires three essential properties: [1, 2]

    1. A Cell-Like Texture: A cellular voronoi pattern to replicate the pressed, individual foam beads.
    2.  
    3. Subsurface Scattering (SSS): To handle light penetration through the semi-translucent foam particles.
    4.  
    5. High Roughness: To achieve the soft, matte look typical of molded polystyrene.
    6.  

    Here is a structured, production-ready MDL shader definition:

     

    Polystyrene MDL Shader Implementation

     

    mdl 1.6;
    
    import ::df::*;
    import ::base::*;
    import ::tex::*;
    import ::math::*;
    
    export material polystyrene_foam(
        color diffuse_color = color(0.95, 0.95, 0.95),
        float cell_scale = 60.0,
        float bump_intensity = 0.15,
        float roughness = 0.85,
        color sss_color = color(0.9, 0.9, 0.9),
        float sss_depth = 0.002 // 2mm penetration depth
    ) = material(
        // Surface Properties
        surface: material_surface(
            scattering: df::microfacet_ggx_smith_bsdf(
                roughness_u: roughness,
                tint: diffuse_color,
                mode: df::scatter_reflect
            )
        ),
        
        // Subsurface Scattering (Crucial for foam realism)
        volume: material_volume(
            scattering: df::anisotropic_vdf(
                directional_bias: 0.0 // Isotropic scattering inside foam
            ),
            scattering_coefficient: color(1.0 / sss_depth) * sss_color,
            absorption_coefficient: color(1.0 / sss_depth) * (color(1.0) - sss_color)
        ),
    
        // Procedural Cell Displacement & Normal Mapping
        geometry: material_geometry(
            // Generates the compressed Styrofoam bead normals
            normal: base::compute_normal_from_lookup(
                texture: base::voronoi_noise_vector(
                    position: base::transform_coordinate(
                        transform: rotation_translation_scale(scale: float3(cell_scale)),
                        coordinate: base::coordinate_source(coordinate_system: base::co_object)
                    )
                ),
                factor: bump_intensity
            )
        )
    );
    

    Key Components Explained

    • base::voronoi_noise_vector: This serves as the foundation for the classic Styrofoam look. It maps a procedural cellular grid to the target 3D object to define individual compressed bubbles. [1]
    •  
    • volume (Subsurface Scattering): Because polystyrene is a compressed polymer, light propagates slightly through the beads before scattering backward. The volume block handles this translucent, glowing light-bleed along thin edges. [1, 2, 3]
    •  
    • df::microfacet_ggx_smith_bsdf: Keeps the material matte and diffuse by utilizing a highly randomized micro-surface profile. [1, 2]
    •  

     

    How to Use This Shader

    You can import this code into platforms utilizing the NVIDIA MDL SDK, such as NVIDIA Omniverse, Adobe Substance 3D, or enterprise renderers like V-Ray and Iray. [1, 2, 3]

     

    Are you compiling this for a specific renderer like NVIDIA Omniverse or Substance Designer, or do you need to modify parameters like bead compression vs. flat foam sheets?

     

    Post edited by Richard Haseltine on
  • jmucchiellojmucchiello Posts: 2,519
    edited September 13

    I don't know what any of that means. I just want a block of foam that isn't soap or water based.

    The only thing here is I see beads in the text there. I don't want beads. Styrofoam is beady. I want fluffly airy foam.

     

     

    The foam surrounding the miniatures is airy, not beady.

     

    Post edited by jmucchiello on
  • WendyLuvsCatzWendyLuvsCatz Posts: 41,753
    edited September 13

    well it can be beads but also moulded but what you are looking for is called foam plastic

    I won't bother asking Gemini to create a shader cheeky

    but this is what it likely is

    AI Overview

     

     

    unknown.png

    Polyurethane and polyethylene are the main foam plastics used to protect delicate gear in camera cases.[1, 2]

     

    Common Types of Case Foam

    • Polyurethane (Open-Cell): Soft, spongy, and flexible, this is the most common standard foam used for pick-and-pluck squares. It cushions light impacts well, though it absorbs moisture. [1, 2]
    •  
    • Polyethylene (Closed-Cell): Firmer, denser, and moisture-resistant. Brands like Clark Rubber and GigGear offer these denser options (such as PE45 or EVA) for heavy or high-value gear. [1, 2]
    •  
    • Kaizen Foam: Layered, peelable sheets let you customize the exact depth for each item without crumbling like traditional pluck foam. Most users on Reddit agree that using an electric carving knife or sharp blade gives the cleanest results with this material. [1, 2]
    •  
    Post edited by WendyLuvsCatz on
  • jmucchiellojmucchiello Posts: 2,519
    edited September 13

    Okay. But is there an existing shader slapping it onto a cube?

    EDIT: There's an animated "memory foam" asset at the hub. But that is far more functional than what I need. I don't need it to react to anything. I'm just looking for the visual. Not the function. If I'm desparate later, it does have an OBJ in it.

    Post edited by jmucchiello on
  • jmucchiellojmucchiello Posts: 2,519

    I'm experimenting with hires images of foam and bump maps. This is a sponge texture. It's rather low res when wrapped around a cube. I probably need to deal with the UV map to get smaller bubbles. Increasing the tiling makes it look like there's tiling. :) I'd probably want to use geo editor (or maybe a dFormer) to make it look like the vase is pressed into the foam.

    (The texture comes from here. I added the blue.)

    vase in foam.png
    540 x 720 - 525K
  • richardandtracyrichardandtracy Posts: 8,221
    edited September 13
    Plastazote (closed cell polyethylene foam) is normally black, or depending on lighting, a dark grey - colours tend to cost extra. The roughness texture could probably be simulated with a PBR skin 8k detail normal texture combined with a diffuse roughness setting. I can't imagine anyone looking at a foam block in extreme detail... OK, I have to as part of my job, but I mean a bit of digital foam. It doesn't help with the foam chips, but does help with fitted foam shock protection. Regards Richard
    Post edited by richardandtracy on
  • I tried importing that "code" into Shader Mixer without success  - I suspect that, if it is any good at all, it has dependencies that are not properely  accounted for.

  • WendyLuvsCatzWendyLuvsCatz Posts: 41,753

    Richard Haseltine said:

    I tried importing that "code" into Shader Mixer without success  - I suspect that, if it is any good at all, it has dependencies that are not properely  accounted for.

    I had absolutely zero expectations of it working

    we needn't fear our AI  overlords yet devil 

Sign In or Register to comment.