Im trying to add light options to kiwiviewer for visualization of medical 3D Models, in my case a surface model of a head.
I cant find a starting point for hours becouse when I delete all glsl shaders I still get the console output "INFO: Compiling shaders:" without error and the View with the 3D Model displaying correctly
I would appreciate any help.
Manuel
At build time, each shader is encoded into a cpp file and compiled into the library named libvesShaders.a. If you modify a shader, but do not recompile the library and relink the application, the app will continue to operate with the previous version of the shader.
If you want to avoid the recompile step, you could create a new shader file and add it to the xcode project so that the file is packaged with the app. Then read the shader source from the file on the iOS filesystem at runtime.
You might want to try the VES mailing list for VES and KiwiViewer questions in the future.
Related
The bounty expires in 3 days. Answers to this question are eligible for a +50 reputation bounty.
Affinity wants to draw more attention to this question.
The idea is having a Utilities.metal shader with helper functions (let's say converting color: rgb2hsv(), ... ) that I want to reuse in many projects. I'd like to access from the local project's metal shader files those helper functions while sharing it as a swift package.
Goals:
Having a Utilities.metal shader file or files in a swift package that I can add to other projects.
Calling that rgb2hsv() function from local shaders. I want to access the functions on that Utilities.metal file from a local executable metal library's (the one that you create in the local project with MTLDevice.makeDefaultLibrary() shaders (doing #include "Utilities.h" in local metal shaders?).
I want the package to contain the .metal files so I can update and commit them from any project (as local package in tandem with the app) not just the metallib.
What I don't want:
Making the bundle library MTLDevice.makeDefaultLibrary(bundle:) to use it inside the package or locally as a stand alone library. I want to link the functions and have access to them.
Avoid if possible hacky things like converting the shaders files to strings and using MTLDevide.makeLibrary(source: source options: nil).
Do I need to use MTLDynamicLibrary? The problem is it's not supported on many devices. Any help is welcome.
I'd like to load a glTF file generated by another program into RealityKit. I get the impression that the only way to load models into RealityKit is via USD or Reality files.
Anyone know a way to get some other model into RealityKit? Not necessarily as a file -- I'd be happy to be able to generate a MeshResource and array of Materials myself and load them in that way.
Reality Converter
Apple discussed this in the WWDC20 video "The artist’s AR toolkit".(link)
They show how to convert FBX, OBJ, USD and GLTF files to USDZs for use in Reality Composer.
Reality Converter is still in beta and needs to be downloaded from the Apple Developer website. I used it and it is quite nice.
There is also other tools you can use on the command line if this is more your thing. At WWDC 2019, Apple announced the USDZ Tools or also called USD Python Tools.
USDZ Tools is a pre-compiled Python library containing binaries of Pixar’s USD library for macOS. This is the link. You will need to download and install the library.
I would give a try to the Reality Converter first. I think it is here to stay since probably Apple has no intention to add support for glTF files in Reality Composer in the future, since they love USBZ!
I ended up using GLTFKit, an open source library by Warren Moore. It does exactly what I want -- lets me load a glTF file into SceneKit/RealityKit.
https://github.com/warrenm/GLTFKit
Alas, as you said, at the moment the only way to load your .gltf model in RealityKit scene – is firstly to convert it into .usdz model via Xcode command line tools. Also in RealityKit you can use .reality format (use it for a much faster uploading time) and .rcproject format that can be exported from Reality Composer app. These two file formats allow you store not only PBR shaders and animation but also a dynamics.
Please, read this post for further details.
I am trying to follow instructions on creating Custom Direct2D Effects, as described in Custom Effects and Effect Shader Linking. I am getting into number of problems:
The "d2d1effecthelpers.hlsli" file in not found in my Windows SDK. I could only find it here.
When trying to run fxc compiler with model set to lib_4_0_level_9_1_ps_only I get an error that this model is not supported.
When using lib_4_0_level_9_1 instead, I get another compilation error, saying that static variables are not supported for libraries (and this static definition comes from the above HLSLI file, not from my code).
After all my goal is to create a pixel shader for Direct2D, which will be receiving number of textures as input. Maybe something in my environment is missing and I can't follow the examples (I'm using Windows 8.1). Any suggestions are welcome.
I already searched the web for a library I can use in my iOS project to show 3D STEP files.
...without success.
Does anyone of you know about a library that can show real 3D STEP files without converting them?
...or does anyone know of an App (that's available in the App Store) that can show STEP files without converting them into another file format before?
Appreciate your help!
Thx,
Dennis
Most STEP files contain BREP/NURBS geometry, which has to be converted to triangles for visualization with graphics libraries like DirectX, OpenGL, or WebGL. For open source, you may want to look at OpenCascade (OCCT and OCE), pythonOCC, FreeCAD, BRL-CAD, and STEPcode.
I swear I have been looking for the answer to this question exhaustively, but I found no real solution to my problem. And what problem is that?
Well I am new to DirectX and shaders. There are a few things about shaders that I still don't get.
1 - How to make a shader? Do I have to create an .fx file in the project? Some times it is so, but in some examples I can't find any .fx file. And how do I make this file? My version of Visual Studio can't directly create .fx files; I have to "force" the file to be .fx.
2 - How I compile them? Are they compiled at the same time I compile solution or they have special ways to compile?
3 - Is there a nice tutorial around? I have been looking for a shaders-bible but mostly I found vague and short tutorials explaining few things, and never in a deep way.
1. New to Shader ?
To get the introduction to sharder use the free shazzam shader editor (http://shazzam-tool.com/) for creating the simple shaders by interactive draw tools. Try to play with different option and then compare the automatically generated HLSL(.fx) codes for better understanding. After you got the feel of how the shader code to be written buy a standard book/online tutorial and practice to write your own code according to your requirements.
2. Common Methods for compilation:
a. D3DXCreateEffectFromFile- Write the shader code and save in .fx extension and dynamically compile the code by D3DXCreateEffectFromFile. Compiled code can be used in your core module using effect(ID3DXEffect) interface.
b. Explicit Compilation: Write the shader code and save in .fx extension and explicitly compile the code using fxc.exe (You can find in DirectX SDK Utility folder).
Example:
fxc.exe /Tfx_2_0 /Fo file.fxo file.fx
After binary file is created follow as below
1. Create a buffer and load the generated binary file(.fxo) by the file stream.
2. Call D3DXCreateEffect and give the buffer content as a input parameter.
3. Like "method a" use effect(ID3DXEffect) interface for interacting with the
shader code.
3. Introduction Tutorial:
http://rbwhitaker.wikidot.com/hlsl-tutorials
Shaders are just like normal text files you put your shader code in them. You don't need to add them to your project if you are compiling the shader at runtime with the D3D functions.
There are two ways to do this. One is putting your shader code in .fx files or *.hlsl files and then compiling the shader at runtime using D3D library functions (D3DCompileFromFile). Though Microsoft is not suggesting this anymore because D3DCompileFromFile won't work in Metro style apps. The other way is to use fxc.exe to compile your shaders at build time. Visual Studio 2012 made this process part of the usual build. So you can add your hlsl files into your project and they will be build when you build your project. This will also enable you to see any errors/warnings in the shader at compile time.
http://msdn.microsoft.com/en-us/library/windows/desktop/bb509633(v=vs.85).aspx
Hope that helps.