[x3d-public] Blender X3D exporter: what to do, how to do it

John Carlson yottzumm at gmail.com
Fri Jul 2 05:54:17 PDT 2021


Here is an example of chromatic dispersion.

https://taylorpetrick.com/blog/post/dispersion-opengl?hidden=true

I removed the fragment shader from previous post.

John

On 7/2/21 7:43 AM, John Carlson wrote:
> Can it do a transparent object which gets a lot of surface color from 
> the surrounding cubemap, yet also refracts?
>
> Like this fragment shader (I can provide a sample vertex shader if 
> you're interested):
>
>
> I think what I may actually be searching for is chromatic 
> dispersion.   Sorry for any confusion.  I guess I should read the code...
>
>
>
> On 7/2/21 7:29 AM, Michalis Kamburelis wrote:
>> In Castle Game Engine, the way to code simple chromatic aberration
>> effect is using "screen effects",
>> https://castle-engine.io/x3d_extensions_screen_effects.php . We used
>> it in "Escape from the Universe",
>> https://www.nintendo.com/games/detail/escape-from-the-universe-switch/
>> .
>>
>> Regards,
>> Michalis
>>
>> pt., 2 lip 2021 o 13:10 John Carlson <yottzumm at gmail.com> napisał(a):
>>> Thanks for your help, Michalis, unfortunately I am buried getting my 
>>> examples working again with X3DJSAIL, X3DOM, and X_ITE,  even my XML 
>>> urls are broken.   Staying on the bleeding edge of other’s work 
>>> means you have to play catch up.
>>>
>>> I have also been updating JSON schema for synonyms, working on 
>>> X3DJSAIL, and making sure view3dscene works in X3D-Edit on Linux.
>>>
>>> I am wanting to get an X3D player to do what I call chromatic 
>>> aberration: rainbow effects like soap bubbles and CDs.   Would you 
>>> like to collaborate?   I need someone to help design the nodes and 
>>> help with implementation.   There’s a glTF extension or two which 
>>> may be somewhat applicable, but probably still incomplete.   I also 
>>> have shaders written for PlayCanvas which might help bootstrap…see 
>>> my flowers.html
>>>
>>> I’ve seen others tackle rainbow effects on CDs, but I’ve lost track 
>>> of the site…
>>>
>>> If there is chromatic aberration in Blender, I can help getting it 
>>> exported.
>>>
>>> John
>>>
>>> On Fri, Jul 2, 2021 at 5:42 AM Michalis Kamburelis 
>>> <michalis.kambi at gmail.com> wrote:
>>>> (sorry for delay in answering -- I was on short vacation)
>>>>
>>>> John -- to get the image (texture for the "base" material property) in
>>>> new Blender, you need to get the texture from the PBR nodes.
>>>>
>>>> You can see e.g. how glTF exporter gets the texture (source code
>>>> https://github.com/KhronosGroup/glTF-Blender-IO , user docs
>>>> https://docs.blender.org/manual/en/dev/addons/import_export/scene_gltf2.html 
>>>>
>>>> ). Basically you have to access the "node tree" of Blender material
>>>> like "material.node_tree.nodes["Principled BSDF"].inputs[0]" and find
>>>> the node with type "ShaderNodeTexImage" that is connected to it. This
>>>> will have an "image" field that contains the Blender image.
>>>>
>>>> You can/should read Blender API docs in
>>>> https://docs.blender.org/api/current/  to know the necessary API. The
>>>> names are also visible as Blender hints (on mouse over) and can be
>>>> even copied using context menu. Be sure to enable "Developer Extras"
>>>> and "Python Tooltips" in Blender preferences, see screenshots.
>>>>
>>>> Regards,
>>>> Michalis
>>>>
>>>> czw., 24 cze 2021 o 23:15 John Carlson <yottzumm at gmail.com> 
>>>> napisał(a):
>>>>> More info, feel free to append to Blender ticket as you see fit. I 
>>>>> clicked on "Image" between the 2 main panels, and set the image to 
>>>>> "tuna.png"  it looked like the image was applied (yay), but 
>>>>> tuna.png did not appear in the .x3d, and the output was still 
>>>>> "Image None" at line 654. And output x3d did not show the texture 
>>>>> in FreeWRL or view3dscene.
>>>>>
>>>>> An investigation of the Blender file:
>>>>>
>>>>> $ strings x3d_texture_2.83.blend|grep png
>>>>> Untitled.png
>>>>> //tuna.png
>>>>> Desktop/Untitled.png
>>>>>
>>>>> So there's still some places to cover.  I do not yet know how to 
>>>>> make image non-None. I did some settings in base color to tuna 
>>>>> (not tuna.png).  It will take some time to figure out all the 
>>>>> windows/panels.  There are a lot of choices in Blender.   It would 
>>>>> probably be worth it to take some classes!
>>>>>
>>>>> Note: This is the only place in the export code that <Appearance> 
>>>>> appears, so this pretty much has to be the code, and we just need 
>>>>> to figure out how to set image variable properly in the preceding 
>>>>> code.
>>>>>
>>>>> If a python programmer could translate this line (614? of 
>>>>> /usr/share/blender/scripts/addons/io_scene_x3d/export_x3d.py ) to 
>>>>> English, it would help!
>>>>>
>>>>> for (material_index, image), polygons_group in 
>>>>> polygons_groups.items():
>>>>>
>>>>> I think this is where the image variable comes from.
>>>>>
>>>>> John
>>>>>
>>>>> On 6/24/21 3:08 PM, John Carlson wrote:
>>>>>
>>>>> I added these lines to the Blender X3D exporter, at line 654
>>>>>
>>>>>                     print("Image", image)
>>>>>                      print("Use H3D", use_h3d)
>>>>>
>>>>>
>>>>> Here is the output:
>>>>>
>>>>> Image None
>>>>> Use H3D False
>>>>>
>>>>> So...the image is not set?  Let's do some snooping:
>>>>>
>>>>> coderextreme at coderextreme-Kubuntu20:~/Downloads$ strings 
>>>>> x3d_texture_2.82.blend |grep png
>>>>> Untitled.png
>>>>> //Untitled.png
>>>>> Desktop/Untitled.png
>>>>> coderextreme at coderextreme-Kubuntu20:~/Downloads$ strings 
>>>>> x3d_texture_2.79.blend |grep png
>>>>> Untitled.png
>>>>> //Untitled.png
>>>>> Desktop/Untitled.png
>>>>>
>>>>> I don't have these pngs.
>>>>>
>>>>> I will look and see how to set the png for the texture, meanwhile, 
>>>>> I don't think that the png exists, therefore, image is None, and 
>>>>> the ImageTexture and TextureTransform don't print!
>>>>>
>>>>> I'll get back to you!
>>>>>
>>>>> John
>>>>>
>>>>> On 6/24/21 1:34 PM, John Carlson wrote:
>>>>>
>>>>> Note:
>>>>>
>>>>> https://developer.blender.org/T66534
>>>>>
>>>>> Has some sample files to start with.
>>>>>
>>>>> On 6/22/21 7:48 AM, Michalis Kamburelis wrote:
>>>>>
>>>>> I wrote a document outlining my Blender->X3D exporter wishlist, and
>>>>> how to submit patches to Blender:
>>>>>
>>>>> https://docs.google.com/document/d/1ad5XsU43gQGxqC7ehSBr21mdX2dQjKZCSXUQtvRwTHw/edit?usp=sharing 
>>>>>
>>>>>
>>>>> Please feel free to distribute it to whoever is interested. 
>>>>> Comments welcome :)
>>>>>
>>>>> Regards,
>>>>> Michalis
>>>>>
>>>>> _______________________________________________
>>>>> x3d-public mailing list
>>>>> x3d-public at web3d.org
>>>>> http://web3d.org/mailman/listinfo/x3d-public_web3d.org



More information about the x3d-public mailing list