marching | A JavaScript library that compiles GLSL ray marchers | Graphics library
kandi X-RAY | marching Summary
kandi X-RAY | marching Summary
Marching.js is a JavaScript shader compiler specifically focused on ray marching via signed distance functions. The goals of this project are:. Marching.js builds on the work of many other people.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of marching
marching Key Features
marching Examples and Code Snippets
Community Discussions
Trending Discussions on marching
QUESTION
I tried to plot all the iso-surfaces generated by the Marching cube LUT by Paul Brouke (http://paulbourke.net/geometry/polygonise/). I chose the vertices to be the midpoint of the edges by the triTable LUT. I am getting these highly skewed surfaces, I am trying to figure out if I am making any error. Here is the matlab code for that.
The results I am getting do not appear to be symmetries of the 14 unique configurations that MC is supposed to provide.. I would like to know where I am going wrong.. I am sure the LUT is right because the source has been used widely..
...ANSWER
Answered 2021-Jun-01 at 16:55I had made a silly mistake of defining the EdgeConnection and vertexList in different numbering notations... I have now edited the code in the question it now works
Thanks a lot to @Ander Biguri for pointing me in the right direction during the debugging
QUESTION
ANSWER
Answered 2021-May-13 at 20:08If you want a media query like solution for javascript you have to listen for the resize
event with an event listener and call the slide function showSlides()
in it. In the slide function you have to wrap the code in the if statement that asks for window.innerWidth
. Additionally you have to define an else block for showing the images again.
QUESTION
I am trying to implement marching cubes into my game, and so far I have set up a system for drawing triangles with four points in world space. I have got the system working where I set the points, but then when I draw the two triangles to make it a mesh, it only draws one, but I set up a print()
statement, and it shows that 2 triangles are drawn each time, so that is normal. I can't figure out what I need to do. Here is my code, and comment on this post if you need any more pics/code:
ANSWER
Answered 2021-May-08 at 21:29I'm pretty sure your issue here is order.
Unity uses a clockwise winding order. This means that
if you provide the triangles in clockwise order the normal will face towards you and you will see the triangle.
if you provide the triangle in counter-clockwise order the normal will face away from you and you will not see the triangle.
Now looking at your code (at least as far as I can tell) your vertices look somewhat like
QUESTION
I made a voxel raycaster in Unity using a compute shader and a texture. But at 1080p, it is limited to a view distance of only 100 at 30 fps. With no light bounces yet or anything, I am quite disappointed with this performance.
I tried learning Vulkan and the best tutorials are based on rasterization, and I guess all I really want to do is compute pixels in parallel on the GPU. I am familiar with CUDA and I've read that is sometimes used for rendering? Or is there a simple way of just computing pixels in parallel in Vulcan? I've already got a template Vulkan project that opens a blank window. I don't need to get any data back from the GPU just render straight to the screen after giving it data.
And with the code below would it be significantly faster in Vulkan as opposed to a Unity compute shader? It has A LOT of if/else statements in it which I have read is bad for GPUs but I can't think of any other way of writing it.
EDIT: I optimized it as much as I could but it's still pretty slow, like 30 fps at 1080p.
Here is the compute shader:
...ANSWER
Answered 2021-Apr-04 at 10:11Compute shader is what it is: a program that runs on a GPU, be it on vulkan, or in Unity, so you are doing it in parallel either way. The point of vulkan, however, is that it gives you more control about the commands being executed on GPU - synchronization, memory, etc. So its not neccesseraly going to be faster in vulkan than in unity. So, what you should do is actually optimise your shaders.
Also, the main problem with if/else is divergence within groups of invocations which operate in lock-step. So, if you can avoid it, the performance impact will be far lessened. These may help you with that.
If you still want to do all that in vulkan...
Since you are not going to do any of the triangle rasterisation, you probably won't need renderpasses or graphics pipelines that the tutorials generally show. Instead you are going to need a compute shader pipeline. Those are far simplier than graphics pipelines, only requiring one shader and the pipeline layout(the inputs and outputs are bound via descriptor sets).
You just need to pass the swapchain image to the compute shader as a storage image in a descriptor (and of course any other data your shader may need, all are passed via descriptors). For that you need to specify VK_IMAGE_USAGE_STORAGE_BIT
in your swapchain creation structure.
Then, in your command buffer you bind the descriptor sets with image and other data, bind the compute pipeline, and dispatch it as you probably do in Unity. The swapchain presentation and submitting the command buffers shouldn't be different than how the graphics works in the tutorials.
QUESTION
I have been studying leetCode and I ran into this problem: Given a string s and an integer k, return the length of the longest substring of s such that the frequency of each character in this substring is greater than or equal to k.
The most elegant solution so far is below but I don't understand
A: What is it trying to do
...ANSWER
Answered 2021-Apr-16 at 20:52If c == 'b'
, s.split(c)
splits the input into
QUESTION
I am experimenting with ray marching, and have been following Jamie Wong's tutorial.
When the moving the camera section comes, they use the function
...ANSWER
Answered 2021-Feb-15 at 06:23OpenTK offers the data types Vector3
, Vector4
and Matrix4
in the OpenTK.Mathematics
namespace.
Assuming you have the vectors:
QUESTION
Found code here for metaballs using vanilla javascript. Is there a way I can change the opacity of the metaballs? I think it should be a quick fix but im not too sure. I tried changing to CSS class bubbles but that didnt work so im assuming in needs to be in the Javascript. Anything helps, thanks.
Found code here for metaballs using vanilla javascript. Is there a way I can change the opacity of the metaballs? I think it should be a quick fix but im not too sure. I tried changing to CSS class bubbles but that didnt work so im assuming in needs to be in the Javascript. Anything helps, thanks.
...ANSWER
Answered 2020-Dec-23 at 05:42You can do it by changing the context alpha channel with RGBA (see at the very bottom ctx.fillStyle = 'rgba(0, 0, 255, 0.5)' // NEW!
where 0.5 is the level of opacity - see ) :
QUESTION
I am working on a project with tf-idf, I have a column (df['liststring']) in my dataframe that contains the preprocessed text (without punctuation, stop words, etc.) from my various documents.
I ran the following code, and I got the top 10 words with the highest tf-idf values but I would like to see their scores as well.
...ANSWER
Answered 2020-Nov-12 at 15:59df_tfidf['top10'] = [[(reverse_vocab.get(item), X_tfidf[i, item]) for item in row]
for i, row in enumerate(tfidf_max10) ]
QUESTION
I have multiple png files and I'm trying to get the polygon contour coordinates. That is the simplified coordinates, only each outer corner (not a convex hull polygon).
The program that will do this at the moment is python and opencv. But another program is oke I did try to fix this using npm packages, imagemagick, potrace, Lua. It will be uses as a shell command in a 'build polygons from images' process.
This was the last test under python.
The problem now is the that some edges are 'not' correct in the example below.
I did the following steps
- Convert the alpha to black and white
- Trace the contour
- Get the coordinates
- The original png file contains black lines (keep them).
- Converted black and white image (you can't see the top line, because this website have a white background)
ANSWER
Answered 2020-Oct-05 at 00:57The points, lines, and curves in a vector graph may be scaled up or down to any resolution with no aliasing. As such you will not see the broken corners. Suppose the output is a vector graph in SVG format. The corners can be visualized nicely by converting each contour to an SVG polygon. You may refer to here for three choices to render the corners. I also add a function add_pixel_fillers
to adjust close enough points.
QUESTION
I am trying to make a 3D-voxel game that uses the marching cubes algorithm to procedurally generate a game world. This is working fine so far, except that, on exactly perpendicular sides on the positive and negative x sides of a given perpendicular piece of the world/chunk mesh, it looks like the uv coordinates aren't quite right as it just displays a solid color instead of the texture. [![view of debug-chunks and the buggy sides][1]][1]
At <2.> you can see the chunk wall how it is supposed to look like and at <1.> you can see the weird bug. This ONLY occurs on exactly perpendicular x-side triangles! Those meshes in the image are debug-chunks to show the problem. All the noise-to-terrain translation works fine and I don't get any bugs there. It's only the uvs that cause problems. I am using the following code to populate the Mesh.vertices, Mesh.triangles and Mesh.uv:
...ANSWER
Answered 2020-Sep-24 at 11:35Well, it turns out that this probably is some weird behavior from unity. When explicitly setting the mesh after the mesh population process as the meshFilters' mesh, it works just fine. Also, I had to call mesh.RecalculateTangents() to make it work.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install marching
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page