Replies: 5 comments
-
Builder::createQuad() builds a regular quad, it's not intended for general geometry creation. The current Builder is written for primitive shapes. |
Beta Was this translation helpful? Give feedback.
-
I was wanting general purpose quad shape functionality as I am investigating porting a Finite Element Analysis (FEA) visualization program that I wrote in OSG over to VSG. I was hoping to render a general 3D quad, assigning a different color to each corner and having those colors blended across the element to represent variations in deflection. stress, etc. I have tried a couple of things already: A) I looked into the post from Carl Sandstrom about a muilti-colored triangle and B) looked into modifying/simplifying the vsgdraw example. For A, I am not talented enough to fill in the gaps. For B, I tried to comment out the functionality that I didn't need but ended up with either a program that crashed or drew mostly black polygons (of the correct shape) with odd-looking triangles of a color I didn't want. They appeared to be invisible when viewed from the backside. Obviously, I don't have a good understanding of what is going on in that example. There's a lot to unpack, even in that short example. I was hoping that you could guide me on this. Also, what do you think of the idea of adding a new example similar to the vsgdraw one that showed how to create a general 3D quad dithered with color, but without texturing? That might make a nice "building block" example for those who need something a bit more flexible than the standard primitive shapes already provided. Thanks in advance, Bob Kiser |
Beta Was this translation helpful? Give feedback.
-
Writing examples on demand for free would be lovely for everyone except I'd never have time do anything else/earn a living. If the backside of your triangle is not visible then this will likely be back facing culling that is one by default. Face culling is controlled by the vsg::RasterizationState object that is used when setting up the vsg::GraphicsPipeline. The class is: https://github.com/vsg-dev/VulkanSceneGraph/blob/master/include/vsg/state/RasterizationState.h The Vulkan state this is associated with is: The cullingFlag propery is the one you'll want to set: The available options are: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkCullModeFlagBits.html You'll want to do something like: auto rasterizationState = vsg::RaserizationState::create(); If we you really want an example but can't get it working then perhaps create the example for vsgExamples and post it as a PR to vsgExamples. Then others in the community can have a look over it, fix the issues, then everyone can benefit for a usable example and you benefit from help from others. |
Beta Was this translation helpful? Give feedback.
-
Hello again Mr. Osfield I took your clue (from above) and married it to a very cut-down copy of the example: vsggraphicspipelineconfigurator.cpp to get much closer to my ultimate goal of an general planar quad with colors dithered from the 4 corners. I tried to remove everything that was not critical to getting the general quad shown. (My code is below.) So now I can see the quad in 3D space where I want it and the front face is dithered like I want it and the back face is now visible, but black. I don't understand what I need to do to get the dithering to show up when viewed from the back side, like it is when viewed from the front side. If I am not abusing your good nature, can you offer a clue about how to handle dithering on the back face? When I get this working, perhaps a candidate for the Examples folder. Thanks in advance, Bob Kiser Here is the code I have thus far: `#include int main(int argc, char** argv)
// mat->value().diffuse.set(1.0f, 1.0f, 1.0f, 1.0f);
}` |
Beta Was this translation helpful? Give feedback.
-
I am away from my dev system so can't test the example. but my best guess
for the back face appearing black is that it's not lit because the normal
is facing away from the light source. The Pbr & Phong shaders have two
sided lighting code paths that you can enable by setting the appropriate
#define when configuring the use of the SHaderSet.
I can't provide an example of this/exact naming of the define off the top
of my head, so will have to wait till tomorrow when I'm back at my dev
system.
|
Beta Was this translation helpful? Give feedback.
-
Is it possible to use Builder createQuad to create a planar 4-sided shape where the opposite sides are not necessarily parallel?
I see that the GeometryInfo class has a parameter named positions and wondered if that could be used to generate a general 4-sided shape.
Thanks in advance,
Bob Kiser
Beta Was this translation helpful? Give feedback.
All reactions