WPF 3D rendering
-
I have started on a project that involves using loading resources on the new glTF format. Namely it from NASAs 3D models of the Solar system: Sun 3D Model | NASA Solar System Exploration[^] The glTF format seems to be easy to load using the glTFLoader that can be downloaded from github. The file itself is just a mix of some header info, a JSON part, and a Binary data part that is pretty well described in the documentation. glTF-Tutorials/gltfTutorial_002_BasicGltfStructure.md at master · KhronosGroup/glTF-Tutorials · GitHub[^] But it is not working exactly. First issue is that the images are loaded, but the texture coordinates seems to be wrong. I have asked this question over at the site that monitors the standard. Load glTF into WPF 3D with a simple viewer - glTF - Khronos Forums[^]. The second issue, which I hope some of you might help me with, is that the diffuse material does not seem to register correctly. So I have to set this via a name property on the diffuse material itself. Then it loads. Any ideas on why that is?
using glTFLoader.Schema;
using glTFLoader;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Windows.Media.Imaging;
using System.Windows.Media;
using System.Windows.Media.Media3D;
using System.Windows;namespace Wpf_glTF_testing
{
public class Earth
{
public UInt32 Magic { get; private set; }public UInt32 Version { get; private set; } public UInt32 TotalFileLength { get; private set; } public UInt32 JsonChuckLength { get; private set; } public UInt32 BinChuckLength { get; private set; } public byte\[\] JSON\_data { get; private set; } public byte\[\] BIN\_data { get; private set; } UInt32 JSON\_hex = 0
-
I have started on a project that involves using loading resources on the new glTF format. Namely it from NASAs 3D models of the Solar system: Sun 3D Model | NASA Solar System Exploration[^] The glTF format seems to be easy to load using the glTFLoader that can be downloaded from github. The file itself is just a mix of some header info, a JSON part, and a Binary data part that is pretty well described in the documentation. glTF-Tutorials/gltfTutorial_002_BasicGltfStructure.md at master · KhronosGroup/glTF-Tutorials · GitHub[^] But it is not working exactly. First issue is that the images are loaded, but the texture coordinates seems to be wrong. I have asked this question over at the site that monitors the standard. Load glTF into WPF 3D with a simple viewer - glTF - Khronos Forums[^]. The second issue, which I hope some of you might help me with, is that the diffuse material does not seem to register correctly. So I have to set this via a name property on the diffuse material itself. Then it loads. Any ideas on why that is?
using glTFLoader.Schema;
using glTFLoader;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Windows.Media.Imaging;
using System.Windows.Media;
using System.Windows.Media.Media3D;
using System.Windows;namespace Wpf_glTF_testing
{
public class Earth
{
public UInt32 Magic { get; private set; }public UInt32 Version { get; private set; } public UInt32 TotalFileLength { get; private set; } public UInt32 JsonChuckLength { get; private set; } public UInt32 BinChuckLength { get; private set; } public byte\[\] JSON\_data { get; private set; } public byte\[\] BIN\_data { get; private set; } UInt32 JSON\_hex = 0
You abstract "... new DiffuseMaterial(), etc." to a separate WPF project; get it working there; then import it back. (Someone was dealing with "DiffuseMaterial" and 3rd party software in Q&A and not getting anywhere either).
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
I have started on a project that involves using loading resources on the new glTF format. Namely it from NASAs 3D models of the Solar system: Sun 3D Model | NASA Solar System Exploration[^] The glTF format seems to be easy to load using the glTFLoader that can be downloaded from github. The file itself is just a mix of some header info, a JSON part, and a Binary data part that is pretty well described in the documentation. glTF-Tutorials/gltfTutorial_002_BasicGltfStructure.md at master · KhronosGroup/glTF-Tutorials · GitHub[^] But it is not working exactly. First issue is that the images are loaded, but the texture coordinates seems to be wrong. I have asked this question over at the site that monitors the standard. Load glTF into WPF 3D with a simple viewer - glTF - Khronos Forums[^]. The second issue, which I hope some of you might help me with, is that the diffuse material does not seem to register correctly. So I have to set this via a name property on the diffuse material itself. Then it loads. Any ideas on why that is?
using glTFLoader.Schema;
using glTFLoader;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Windows.Media.Imaging;
using System.Windows.Media;
using System.Windows.Media.Media3D;
using System.Windows;namespace Wpf_glTF_testing
{
public class Earth
{
public UInt32 Magic { get; private set; }public UInt32 Version { get; private set; } public UInt32 TotalFileLength { get; private set; } public UInt32 JsonChuckLength { get; private set; } public UInt32 BinChuckLength { get; private set; } public byte\[\] JSON\_data { get; private set; } public byte\[\] BIN\_data { get; private set; } UInt32 JSON\_hex = 0
-
You abstract "... new DiffuseMaterial(), etc." to a separate WPF project; get it working there; then import it back. (Someone was dealing with "DiffuseMaterial" and 3rd party software in Q&A and not getting anywhere either).
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
I figured it out anyways. :)
-
(... stumble stumble ...) Ran across this idea this morning: https://stackoverflow.com/questions/tagged/wpf+3d[^]. Nothing to see here. Move along then.
Nah, I came across an article that solved everything for me: Introduction to glTF for WPF 3D[^]